Improve the notification message and frequency.

This commit is contained in:
me committed 2026-10-29 19:54:12 -07:00
1 parent 1fc42b4e4e
commit b0acb7793a
1 file changed
+8 -5
+8 -5
View File
@@ -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