From 8433a923bae670756753a74405f711a3dcff8fea Mon Sep 17 00:00:00 2001 From: pfych Date: Fri, 25 Jul 2025 18:31:10 +1000 Subject: [PATCH] Added temp and date to taskbar --- .config/scripts/util/taskbar.sh | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.config/scripts/util/taskbar.sh b/.config/scripts/util/taskbar.sh index bb300f7..bb621bb 100755 --- a/.config/scripts/util/taskbar.sh +++ b/.config/scripts/util/taskbar.sh @@ -5,7 +5,7 @@ NOW=$(date +%s) debounce () { local -n VAR_REFERENCE=$1 # Funky Bash Pass-by-reference here! VAR_NAME="$1" - DEBOUNCE_TIME="$2" + DEBOUNCE_TIME="$2" # In Seconds FUNCTION=$3 FALLBACK=$4 @@ -56,6 +56,18 @@ get_monero_text () { cat /tmp/last-monero-value } +get_date () { + date +%a" "%d" "%b" "%I:%M" "%P > /tmp/last-date + cat /tmp/last-date +} + +get_temps () { + TEMP=$(sensors | grep Tctl | cut -d"+" -f 2 | cut -d"." -f 1) + + echo "$TEMP°C" > /tmp/last-temp + cat /tmp/last-temp +} + debounce MOUSE_STRING 3600 \ "$(get_mouse_text)" \ "$(cat /tmp/last-mouse-level || get_mouse_text)"; @@ -64,4 +76,12 @@ debounce MONERO_STRING 60 \ "$(get_monero_text)" \ "$(cat /tmp/last-monero-value || get_monero_text)"; -echo "| $MOUSE_STRING | $MONERO_STRING |" +debounce DATE_STRING 5 \ + "$(get_date)" \ + "$(cat /tmp/last-date || get_date)"; + +debounce TEMP_STRING 5 \ + "$(get_temps)" \ + "$(cat /tmp/last-temp || get_temps)" + +echo " $TEMP_STRING | $MOUSE_STRING | $MONERO_STRING | $DATE_STRING"