From 5c753ff5ec79f559cfe8670277207ec51138e0fd Mon Sep 17 00:00:00 2001 From: Michael Bradley Date: Thu, 27 Mar 2025 01:12:14 -0400 Subject: [PATCH 1/2] Don't pad H/M/S from `date` Caused occasional script failures, was it trying to interpret as octal? --- scripts/sunset.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sunset.sh b/scripts/sunset.sh index 873db0f..ebdcc4e 100755 --- a/scripts/sunset.sh +++ b/scripts/sunset.sh @@ -9,7 +9,7 @@ SUNSET_END="$((23 * 60 * 60))" # When to reach min temperature DAY_TEMP="6000" # Display temperature (K) to use in full daylight NIGHT_TEMP="2400" # Display temperature (K) to use at night -CURRENT="$(((($(date '+%H') * 60) + $(date '+%M')) * 60 + $(date '+%S')))" # Time in seconds since start of day +CURRENT="$(((($(date '+%-H') * 60) + $(date '+%-M')) * 60 + $(date '+%-S')))" # Time in seconds since start of day # Performs a calculation using an argument containing an input string calc() { From 68b2e276c3041325a5c911e4d77112fbe42f0e3c Mon Sep 17 00:00:00 2001 From: Michael Bradley Date: Thu, 27 Mar 2025 01:37:33 -0400 Subject: [PATCH 2/2] Make sunset timer more accurate --- scripts/sunset.sh | 1 + systemd/sunset.timer | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/sunset.sh b/scripts/sunset.sh index ebdcc4e..fb25f57 100755 --- a/scripts/sunset.sh +++ b/scripts/sunset.sh @@ -61,4 +61,5 @@ else TEMP="$NIGHT_TEMP" fi +# TODO: Figure out a nice way to wait until Hyprland has properly started up before running this hyprctl hyprsunset temperature "$TEMP" diff --git a/systemd/sunset.timer b/systemd/sunset.timer index 2f2da6c..ac60c6b 100644 --- a/systemd/sunset.timer +++ b/systemd/sunset.timer @@ -6,6 +6,7 @@ After=hyprsunset.service [Timer] OnCalendar=*-*-* *:*:00 Persistent=true +AccuracySec=5s [Install] WantedBy=timers.target