Преглед изворни кода

Add colors to temperature status section

Frans Bergman пре 4 година
родитељ
комит
81d2e9be64
1 измењених фајлова са 11 додато и 1 уклоњено
  1. 11 1
      .scripts/status/40-temp.sh

+ 11 - 1
.scripts/status/40-temp.sh

@@ -1,2 +1,12 @@
 #!/bin/sh
-sensors | awk '/Package/{print $4}'
+
+TEMP="$(sensors | awk '/Package/{print $4}')"
+NUMTEMP="$(echo "$TEMP" | tr -dc '0-9')"
+if [ "$NUMTEMP" -ge 700 ]; then
+    TEMPCOL=""
+elif [ "$NUMTEMP" -ge 500 ]; then
+    TEMPCOL=""
+else
+    TEMPCOL=""
+fi
+echo "$TEMPCOL$TEMP"