This repository has been archived on 2019-02-28. You can view files and clone it, but cannot push or open issues or pull requests.

43 lines
1.1 KiB
Bash
Executable File

[[ "$BLOCK_BUTTON" == 2 ]] && i3-sensible-terminal -e htop
sensors *-isa-* | awk -v BAR="${BAR[*]}" -v BW="${BW[*]}" -v COLORS="$COLORS" -v COLOR="${COLOR[*]}" -v LONG="$LONG" '
BEGIN {
split(BAR, bar, / /)
split(COLOR, color, / /)
split(BW, bw, / /)
interval = 100 / length(bar)
}
match($0, /^Package[^\+]*\+([0-9]{1,3})[^\+]*\+([0-9]{1,3})/, matches) {
temp = matches[1]
high = matches[2]
step = high / 8
treshold = 40
load = (temp - treshold) / (high - treshold) * 100
}
END {
if (LONG) {
printf("%d°C\n%d°C\n", temp, temp)
} else {
for (i in bar) {
if (load <= i * interval) {
printf("%s\n%s\n", bar[i], bar[i])
break
}
}
}
for (i in bw) {
if (load <= i * interval) {
if (COLORS) {
printf("%s\n", color[i])
} else {
printf("%s\n", bw[i])
}
break
}
}
}
'