summaryrefslogtreecommitdiff
path: root/i3blocks-cputemp.sh
diff options
context:
space:
mode:
authorAdam T. Carpenter <atc@sparrowhawk.53hor.net>2020-05-13 08:19:11 -0400
committerAdam T. Carpenter <atc@sparrowhawk.53hor.net>2020-05-13 08:19:11 -0400
commit8b1a2abb3bc497af04f9531db46af4b0dda42117 (patch)
tree14e91cc7a77d6d4756d58db6e004cdab3546f627 /i3blocks-cputemp.sh
parentb184782970853b3c479f6c4ad833a36a3aea7afa (diff)
downloadscripts-8b1a2abb3bc497af04f9531db46af4b0dda42117.tar.xz
scripts-8b1a2abb3bc497af04f9531db46af4b0dda42117.zip
updated for FreeBSD userland, included wpg scripts
Diffstat (limited to 'i3blocks-cputemp.sh')
-rwxr-xr-xi3blocks-cputemp.sh14
1 files changed, 8 insertions, 6 deletions
diff --git a/i3blocks-cputemp.sh b/i3blocks-cputemp.sh
index 94a9a2b..c88ecef 100755
--- a/i3blocks-cputemp.sh
+++ b/i3blocks-cputemp.sh
@@ -1,14 +1,16 @@
#!/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
+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
-printf " %s ℉\n" $fahrenheit
+#printf " %s C\n" $celcius
+
+# 'Murica
+printf " %s ℉\n" $(echo "scale=1; $celcius * 9 / 5 + 32" | bc -l)