dwmbar/modules/cputemp

26 lines
456 B
Text
Raw Normal View History

2019-10-21 19:14:37 +00:00
#!/bin/bash
# Gets temperature of the CPU
# Dependencies: lm_sensors
2019-11-06 15:46:58 +00:00
PREFIX=' '
FIRE=' '
WARNING_LEVEL=80
2019-11-06 15:07:14 +00:00
get_cputemp()
2019-10-21 19:14:37 +00:00
{
# CPU_T=$(cat /sys/devices/platform/coretemp.0/hwmon/hwmon?/temp2_input)
# CPU_TEMP=$(expr $CPU_T / 1000)
2019-11-06 15:46:58 +00:00
CPU_TEMP="$(sensors | grep temp1 | awk 'NR==1{gsub("+", " "); gsub("\\..", " "); print $2}')"
2023-03-01 08:37:05 +00:00
if [[ "$CPU_TEMP" -ge $WARNING_LEVEL ]]; then
2019-11-06 15:46:58 +00:00
PREFIX="$FIRE$PREFIX"
fi
2019-10-21 19:14:37 +00:00
2019-11-06 15:46:58 +00:00
echo "$PREFIX$CPU_TEMP°C"
2019-10-21 19:14:37 +00:00
}
2019-11-06 15:07:14 +00:00
get_cputemp