26 lines
559 B
Bash
Executable File
26 lines
559 B
Bash
Executable File
#!/bin/bash
|
|
|
|
[[ "$BLOCK_BUTTON" == 1 ]] && i3-sensible-terminal -e htop
|
|
top -bn1 | gawk '
|
|
/^\%CPU/ {
|
|
cpu = 100 - $8
|
|
}
|
|
END {
|
|
printf("%d%\n", cpu)
|
|
printf("%d\n", cpu)
|
|
if (cpu < 50) {
|
|
print("#04B431\n")
|
|
} else if (cpu < 60) {
|
|
print("#A8FF00\n")
|
|
} else if (cpu < 70) {
|
|
print("#FFF600\n")
|
|
} else if (cpu < 80) {
|
|
print("#FFAE00\n")
|
|
} else if (cpu < 90) {
|
|
print("#FF0000\n")
|
|
} else {
|
|
exit 33
|
|
}
|
|
}
|
|
'
|