Move Night Light onto a first-party nightlight service

Same treatment as Stay Awake: the indicator polled the toggle CLI over
a Process with a timer to paper over the race after clicking, and the
CLI ended by asking the shell to refresh every indicator over IPC. A new
omarchy.nightlight service owns hyprsunset instead - it probes the
temperature on startup, applies changes itself for in-shell toggles, and
answers on the nightlight IPC target. The indicator becomes a plain
binding. The CLI still drives hyprctl directly so keybindings, the menu,
and ssh work without the shell, but now just nudges the service to
re-probe since hyprsunset has no state file to watch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-07-21 15:26:20 -07:00
co-authored by Claude Fable 5
parent 61b7cd1c12
commit ba91bad3a4
8 changed files with 220 additions and 46 deletions
@@ -33,11 +33,20 @@ ShellRoot {
}
}
QtObject {
id: nightlightService
property bool enabled: false
function setNightlight(value) {
enabled = !!value
}
}
QtObject {
id: mockShell
function firstPartyServiceFor(id) {
if (id === "omarchy.notifications") return notificationService
if (id === "omarchy.idle") return idleService
if (id === "omarchy.nightlight") return nightlightService
return null
}
}
@@ -175,7 +184,7 @@ ShellRoot {
nightLight.moduleName = "NightLight"
root.injectBar(nightLight)
nightLight.triggerPress(Qt.LeftButton)
root.assertTrue(root.commandCount("omarchy-toggle-nightlight") === 1, "Night Light left click runs toggle command")
root.assertTrue(nightlightService.enabled === true, "Night Light left click toggles the nightlight service")
}
var screenRecording = root.createIndicator("ScreenRecording")