Dont pass resolved value

This commit is contained in:
pfych 2025-08-01 08:29:39 +10:00 committed by Violet Heague
parent 9515db1282
commit a6cda45c5b

View file

@ -10,16 +10,16 @@ debounce () {
FALLBACK=$4 FALLBACK=$4
if [ ! -f "/tmp/debounce-$VAR_NAME" ]; then if [ ! -f "/tmp/debounce-$VAR_NAME" ]; then
VAR_REFERENCE="$FUNCTION" VAR_REFERENCE="$($FUNCTION)"
echo "$(date +%s)" > "/tmp/debounce-$VAR_NAME" echo "$(date +%s)" > "/tmp/debounce-$VAR_NAME"
else else
LAST_CHECK=$(cat "/tmp/debounce-$VAR_NAME") LAST_CHECK=$(cat "/tmp/debounce-$VAR_NAME")
if [ $(($NOW - $LAST_CHECK)) -gt $DEBOUNCE_TIME ]; then if [ $(($NOW - $LAST_CHECK)) -gt $DEBOUNCE_TIME ]; then
VAR_REFERENCE="$FUNCTION" VAR_REFERENCE="$($FUNCTION)"
echo "$(date +%s)" > "/tmp/debounce-$VAR_NAME" echo "$(date +%s)" > "/tmp/debounce-$VAR_NAME"
else else
VAR_REFERENCE="$FALLBACK" VAR_REFERENCE="$($FALLBACK)"
fi fi
fi fi
} }
@ -69,19 +69,19 @@ get_temps () {
} }
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";
debounce MONERO_STRING 60 \ 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";
debounce DATE_STRING 5 \ debounce DATE_STRING 5 \
"$(get_date)" \ "get_date" \
"$(cat /tmp/last-date || get_date)"; "cat /tmp/last-date || get_date";
debounce TEMP_STRING 5 \ debounce TEMP_STRING 5 \
"$(get_temps)" \ "get_temps" \
"$(cat /tmp/last-temp || get_temps)" "cat /tmp/last-temp || get_temps"
echo " $TEMP_STRING | $MOUSE_STRING | $MONERO_STRING | $DATE_STRING" echo " $TEMP_STRING | $MOUSE_STRING | $MONERO_STRING | $DATE_STRING"