aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.config/polybar/scripts/temperature.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/.config/polybar/scripts/temperature.sh b/.config/polybar/scripts/temperature.sh
new file mode 100755
index 0000000..10c8ddc
--- /dev/null
+++ b/.config/polybar/scripts/temperature.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# Pulls CPU temps, averages them, and outputs them
+
+let count=0
+sum=0.0
+for temp in $(sensors | grep "^Core" | grep -e '+.*C' | cut -f 2 -d '+' | cut -f 1 -d ' ' | sed 's/°C//'); do
+ sum=$(echo $sum+$temp | bc)
+ let count+=1
+done
+avg=$(qalc -t $sum/$count)
+echo "${avg}°C"