feat(nightlight): persistent off via state marker

A manual `off` now drops ~/.local/state/nomarchy/nightlight-off and the
hyprsunset unit refuses to (re)start while it exists
(Unit.ConditionPathExists=!%h/...), so the off survives logout/reboot
until toggled back on. `on`/toggle-on remove the marker before starting
(a failed condition would otherwise no-op the start). Without the marker
behaviour is unchanged: the service stays WantedBy=graphical-session.target
and resumes its schedule at login, so persistence is opt-in via the toggle.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-06-20 20:09:22 +01:00
parent d1344712b8
commit 5747dc9839
2 changed files with 29 additions and 14 deletions

View File

@@ -459,15 +459,17 @@ how to override it. Items marked ✓ are shipped.
`nomarchy-menu nightlight` entry (System submenu, self-gated on the unit
existing) and a self-gating Waybar `custom/nightlight` indicator (moon = on,
sun = off; in the generated bar and both summer whole-swaps) drive it.
The toggle is **session-scoped by design**: `stop` halts the running unit
but it's `WantedBy=graphical-session.target`, so the next login auto-starts
it and night-light returns to its schedule (off never persists). Remaining
(optional): (1) **persistent off** — a state marker
(`~/.local/state/nomarchy/nightlight-off`) the unit honours via
`ConditionPathExists=!%h/…`, so a manual off survives logout/reboot until
toggled back; (2) geo (lat/long) auto sunset/sunrise (would mean wlsunset,
which schedules by location). Pending an on-machine check that stopping
hyprsunset cleanly restores the gamma.
**Persistent off:** a manual `off` now drops a marker
(`~/.local/state/nomarchy/nightlight-off`) and the unit refuses to (re)start
while it exists (`Unit.ConditionPathExists=!%h/…`), so an off survives
logout/reboot until toggled back on; `on`/toggle-on remove the marker first
(a failed condition would otherwise no-op the start). Without the marker the
service stays `WantedBy=graphical-session.target` and resumes its schedule at
login as before — the session-scoped behaviour is now the *default*, with
persistence opt-in via the toggle. Remaining (optional): geo (lat/long) auto
sunset/sunrise (would mean wlsunset, which schedules by location). Pending an
on-machine check (off persisting across reboot, and that stopping hyprsunset
cleanly restores the gamma).
- **Keyboard layouts (per-device + switching):**
-**Per-device declarative layout:** `nomarchy.keyboard.devices`
(`{ "<hyprctl-device-name>" = { layout; variant; }; }`) generates Hyprland