summaryrefslogtreecommitdiff
path: root/i3blocks-cputemp.sh
blob: faac2de5dcad04021d79383eee8f4ed850204b55 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh
#low=122 # 50C
high=176 # 80C
#icon_low=󱃃
#icon_mid=󰔏
#icon_high=󱃂
icon=󰔏

celcius=$(sysctl -n dev.cpu.0.temperature | cut -d'.' -f1)
#[ $celcius -lt $low ] && printf $icon_low
#[ $celcius -ge $low ] && [ $fahrenheit -lt $high ] && printf $icon_mid
#[ $celcius -ge $high ] && printf $icon_high
[ $celcius -ge $high ] && notify-send "CPU temperature hit 176F (80C)"

#printf " %s C\n" $celcius

# 'Murica
printf "$icon%s ℉\n" $(echo "scale=1; $celcius * 9 / 5 + 32" | bc -l)