Added temp and date to taskbar

This commit is contained in:
pfych 2025-07-25 18:31:10 +10:00
parent 818089e853
commit 8433a923ba

View file

@ -5,7 +5,7 @@ NOW=$(date +%s)
debounce () { debounce () {
local -n VAR_REFERENCE=$1 # Funky Bash Pass-by-reference here! local -n VAR_REFERENCE=$1 # Funky Bash Pass-by-reference here!
VAR_NAME="$1" VAR_NAME="$1"
DEBOUNCE_TIME="$2" DEBOUNCE_TIME="$2" # In Seconds
FUNCTION=$3 FUNCTION=$3
FALLBACK=$4 FALLBACK=$4
@ -56,6 +56,18 @@ get_monero_text () {
cat /tmp/last-monero-value 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 \ debounce MOUSE_STRING 3600 \
"$(get_mouse_text)" \ "$(get_mouse_text)" \
"$(cat /tmp/last-mouse-level || get_mouse_text)"; "$(cat /tmp/last-mouse-level || get_mouse_text)";
@ -64,4 +76,12 @@ debounce MONERO_STRING 60 \
"$(get_monero_text)" \ "$(get_monero_text)" \
"$(cat /tmp/last-monero-value || 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"