From 3107ec94e9da7d752f98db97973111c247c84544 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 21 Jul 2026 16:01:49 -0700 Subject: [PATCH] Resend nightlight temperature until it sticks on hyprsunset cold start A freshly-started hyprsunset applies its default temperature at the end of boot, silently overriding a set sent while it was still starting. Co-Authored-By: Claude Fable 5 --- bin/omarchy-toggle-nightlight | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/omarchy-toggle-nightlight b/bin/omarchy-toggle-nightlight index d879463f..af717245 100755 --- a/bin/omarchy-toggle-nightlight +++ b/bin/omarchy-toggle-nightlight @@ -37,16 +37,23 @@ fi # Ensure hyprsunset is running if ! pgrep -x hyprsunset >/dev/null; then setsid uwsm-app -- hyprsunset & - sleep 1 # Give it time to register fi # Query the current temperature CURRENT_TEMP=$(current_temp) if [[ -z $CURRENT_TEMP || $CURRENT_TEMP == $OFF_TEMP ]]; then - hyprctl hyprsunset temperature $ON_TEMP + TARGET_TEMP=$ON_TEMP else - hyprctl hyprsunset temperature $OFF_TEMP + TARGET_TEMP=$OFF_TEMP fi +# A freshly-started hyprsunset applies its default temperature at the end of +# its boot, overriding anything set before then — so resend until it sticks +for _ in {1..10}; do + hyprctl hyprsunset temperature $TARGET_TEMP >/dev/null 2>&1 + sleep 0.2 + [[ $(current_temp) == "$TARGET_TEMP" ]] && break +done + omarchy-shell -q nightlight refresh