From b0acb7793a865ceb3ea89b8dd74272c694267780 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Thu, 29 Oct 2026 19:54:12 -0700 Subject: [PATCH] Improve the notification message and frequency. --- sunset-alarm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sunset-alarm b/sunset-alarm index 0de1218..749d216 100755 --- a/sunset-alarm +++ b/sunset-alarm @@ -94,8 +94,12 @@ fetch_sunset_time() { # Show alert via fallback chain: fyi -> notify-send -> wall ############################################################################### show_alert() { - TITLE="Sunset Alarm" - MESSAGE="Sunset is at $(date -d @${SUNSET_EPOCH} +"%H:%M")." + ALERT=$(date -d @${ALERT_WINDOW_START} +"%H:%M") + SUNSET=$(date -d @${SUNSET_EPOCH} +"%H:%M") + PLURAL=$(if (( $MINUTES != 1 )); then echo "s"; fi) + + TITLE="Sunset Alarm ($ALERT)" + MESSAGE="It's ${MINUTES} minute${PLURAL} to $SUNSET." persistent="-t 0 --wait" icon="-i weather-clear -u critical" @@ -159,13 +163,12 @@ while true; do if [ "$CURRENT_TIME" -ge "$ALERT_WINDOW_START" ] && \ [ "$CURRENT_TIME" -lt "$MIDNIGHT" ]; then show_alert - sleep 5 # Re-alert every 5 minutes while in alert window - else - sleep 60 fi # Reset when we've passed midnight so we fetch new time tomorrow if [ "$CURRENT_TIME" -ge "$MIDNIGHT" ]; then LAST_DATE="" fi + + sleep 10 done