dotfiles/yambar/temp.sh

22 lines
526 B
Bash
Raw Normal View History

2022-08-29 23:02:24 +02:00
#!/bin/sh
temp="$( (cat /sys/class/thermal/thermal_zone*/temp 2>/dev/null | maths max | tr -d $'\n'; echo " / 1000") | bc)"
rpm="$(sudo fan_control rpm 1)"
if test "$temp" -ge 60 && test "${rpm% RPM}" -lt 100; then
rpm="$(sudo fan_control rpm 1)"
fi
2022-08-29 23:02:24 +02:00
echo "temp|int|$temp"
echo "rpm|int|${rpm% RPM}"
if test "$temp" -ge 90; then
status=alert
elif test "$temp" -ge 80; then
status=caution
elif test "$temp" -ge 60 || test "${rpm% RPM}" -gt 3000; then
2022-08-29 23:02:24 +02:00
status=active
else
status=normal
fi
echo "status|string|$status"
echo