summaryrefslogtreecommitdiff
path: root/i3blocks-cputemp.sh
blob: 94a9a2bd6e3cc006c6a77ec0d8692c7fc6957edd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh
kelvins=$(cat /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input)
low=122 # 50C
high=176 # 80C
icon_low=󱃃
icon_mid=󰔏
icon_high=󱃂

fahrenheit=$(expr $(expr $(expr $(expr $kelvins \* 9) / 5) / 1000) + 32)
[ $fahrenheit -lt $low ] && printf $icon_low
[ $fahrenheit -ge $low ] && [ $fahrenheit -lt $high ] && printf $icon_mid
[ $fahrenheit -ge $high ] && printf $icon_high

printf " %s ℉\n" $fahrenheit