add cpu temp suport
This commit is contained in:
parent
2cc792dd51
commit
2905efa5aa
8
config
8
config
@ -31,7 +31,13 @@ instance=ram
|
||||
|
||||
[cpu]
|
||||
label=☷
|
||||
# instance=long
|
||||
instance=long
|
||||
interval=2
|
||||
|
||||
[temp]
|
||||
label=ϑ
|
||||
interval=2
|
||||
instance=long
|
||||
|
||||
[ip]
|
||||
# label=ip
|
||||
|
52
modules/temp
Executable file
52
modules/temp
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
[[ "$BLOCK_INSTANCE" =~ "long" || "$BLOCK_BUTTON" == 1 ]] && LONG=true
|
||||
|
||||
[[ "$BLOCK_BUTTON" == 2 ]] && i3-sensible-terminal -e htop
|
||||
|
||||
sensors *-isa-* | awk -v LONG="$LONG" '
|
||||
match($0, /^Package[^\+]*\+([0-9]{1,3})[^\+]*\+([0-9]{1,3})/, matches) {
|
||||
temp = matches[1]
|
||||
high = matches[2]
|
||||
step = high / 8
|
||||
tresholdc = 40
|
||||
stepc = ( high - tresholdc ) / 6
|
||||
}
|
||||
END {
|
||||
if (LONG == "true") {
|
||||
printf("%d°C\n", temp)
|
||||
printf("%d°C\n", temp)
|
||||
} else {
|
||||
if (temp < step) {
|
||||
printf("▁\n▁\n")
|
||||
} else if (temp < step * 2 ) {
|
||||
printf("▂\n▂\n")
|
||||
} else if (temp < step * 3 ) {
|
||||
printf("▃\n▃\n")
|
||||
} else if (temp < step * 4 ) {
|
||||
printf("▄\n▄\n")
|
||||
} else if (temp < step * 5 ) {
|
||||
printf("▅\n▅\n")
|
||||
} else if (temp < step * 6 ) {
|
||||
printf("▆\n▆\n")
|
||||
} else if (temp < step * 7 ) {
|
||||
printf("▇\n▇\n")
|
||||
} else {
|
||||
printf("█\n█\n")
|
||||
}
|
||||
}
|
||||
if (temp < stepc + tresholdc) {
|
||||
print("#04B431\n")
|
||||
} else if (temp < stepc * 2 + tresholdc) {
|
||||
print("#A8FF00\n")
|
||||
} else if (temp < stepc * 3 + tresholdc) {
|
||||
print("#FFF600\n")
|
||||
} else if (temp < stepc * 4 + tresholdc) {
|
||||
print("#FFAE00\n")
|
||||
} else if (temp < stepc * 5 + tresholdc) {
|
||||
print("#FF0000\n")
|
||||
} else {
|
||||
exit 33
|
||||
}
|
||||
}
|
||||
'
|
Reference in New Issue
Block a user