From 80469fc51e646290b32901eacb52bb97a1c22a0f Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 21 May 2026 07:59:35 +0200 Subject: [PATCH] Fix night light status when hyprsunset is unavailable --- bin/omarchy-toggle-nightlight | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/omarchy-toggle-nightlight b/bin/omarchy-toggle-nightlight index b835bff6..92163a99 100755 --- a/bin/omarchy-toggle-nightlight +++ b/bin/omarchy-toggle-nightlight @@ -8,7 +8,10 @@ ON_TEMP=4000 OFF_TEMP=6000 current_temp() { - hyprctl hyprsunset temperature 2>/dev/null | grep -oE '[0-9]+' | head -n1 + local output + + output=$(hyprctl hyprsunset temperature 2>/dev/null) || return + grep -oE '[0-9]+' <<<"$output" | head -n1 } status_json() { @@ -39,7 +42,7 @@ fi # Query the current temperature CURRENT_TEMP=$(current_temp) -if [[ $CURRENT_TEMP == $OFF_TEMP ]]; then +if [[ -z $CURRENT_TEMP || $CURRENT_TEMP == $OFF_TEMP ]]; then hyprctl hyprsunset temperature $ON_TEMP else hyprctl hyprsunset temperature $OFF_TEMP