Fix night light status when hyprsunset is unavailable

This commit is contained in:
David Heinemeier Hansson
2026-05-21 07:59:35 +02:00
parent d1b452cc5f
commit 80469fc51e
+5 -2
View File
@@ -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