feat(menu): #79 slice 3 — Look & Feel › Auto theme (completes #79)
All checks were successful
Check / eval (push) Successful in 3m46s

Adds an "Auto theme (on/off)" row to Look & Feel and an `autotheme`
submenu: toggle the feature, pick the day/night themes (from
`nomarchy-theme-sync list`), and set the sunrise/sunset times (HH:MM,
validated). This is the menu surface over settings.autoTheme, completing
the auto time-of-day theme feature (slices: CLI / timer / menu).

Enabling writes the flag and defaults the summer-day/summer-night pair
--no-switch, then runs `auto --force`, so a single rebuild both installs
the timer and applies the correct theme for now. Disabling is instant
(--no-switch): the flag flips and `auto` self-gates, so the lingering
timer no-ops until the next rebuild. Day/night/time writes are live
--no-switch (read by `auto` at tick time).

Verification: V1 — HM generation builds (bash -n on nomarchy-menu at
build) + bash -n on the built menu. Logic test with stubbed
rofi/theme-sync/notify: selecting the toggle from off runs exactly `set
day/night/enable ... --no-switch` then `auto --force` — the intended
one-rebuild path. V0 flake check green. All three #79 slices shipped;
the live timer switch across sunset is a real-session (V3) check on a
Nomarchy machine.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-07-10 21:53:37 +01:00
parent c44616aeb0
commit 860c70466f
5 changed files with 118 additions and 23 deletions

View File

@@ -28,28 +28,22 @@ in [`docs/ROADMAP.md`](../docs/ROADMAP.md); map in
## NEXT
### 79. Auto time-of-day theme pair (`VISION § D`) `[big]` — split
Auto light/dark theme switch through the **existing** engine (a timer runs
`nomarchy-theme-sync apply`), one pipeline. State: `settings.autoTheme`
`{enable, day, night, sunrise, sunset}` in theme-state.json. Slices:
1. ~~**CLI primitive + schema**~~ ✓ shipped 2026-07-10 —
`nomarchy-theme-sync auto` resolves day/night from
`settings.autoTheme.{enable,day,night,sunrise,sunset}` and applies (only
if different — idempotent, so the timer won't needlessly rebuild);
`--which` prints the decision, `--force`/`--no-switch` too. `cmd_apply`
core factored into `apply_named` (behavior unchanged). V1 + functional
tests (day/night/disabled/missing-slugs, apply writes state, idempotent).
2. ~~**Timer/hook**~~ ✓ shipped 2026-07-10 — `modules/home/autotheme.nix`:
`systemd.user.{service,timer}.nomarchy-auto-theme`, install gated on
`settings.autoTheme.enable` (read from state), `OnStartupSec=1min` +
`OnCalendar=*:0/15` + `Persistent`. Chose periodic (not exact
sunrise/sunset timers) — robust to suspend/DST, and `auto` is idempotent
so ticks are cheap. V1: real-config eval shows units land when enabled
(OnCalendar `*:0/15`, ExecStart `… auto`), absent when disabled;
systemd-analyze validates the schedule. **Real-session check pending**
(live timer→`home-manager switch`) — needs a Nomarchy machine, like #76.
3. **Menu** — Look & Feel Auto theme: enable/disable, pick day/night
themes, set times. Writes state.
### 79. Auto time-of-day theme pair — all agent work shipped `[blocked:hw]`
Auto light/dark theme switch through the existing engine, one pipeline
(`VISION § D`). All 3 slices shipped 2026-07-10; design record in ROADMAP.
Only the real-session check remains (needs a Nomarchy machine, like #76):
- **CLI** — `nomarchy-theme-sync auto` (idempotent day/night apply;
`--which`/`--force`/`--no-switch`); `cmd_apply` core → `apply_named`.
- **Timer** — `modules/home/autotheme.nix`: user service+timer, install
gated on `settings.autoTheme.enable`, `OnStartupSec=1min` +
`OnCalendar=*:0/15` + `Persistent`.
- **Menu** — Look & Feel Auto theme: toggle, pick day/night, set times
(enable rebuilds to install the timer + `auto --force`; disable is
instant `--no-switch`; day/night/times live `--no-switch`).
**V3 remaining:** on a real Nomarchy session — enable from the menu, confirm
the timer switches day↔night across the sunset/sunrise boundary (and the
live `home-manager switch` from the timer succeeds).
### 76. Hibernation default — all agent work shipped `[blocked:hw]`
Hibernation + zram on by default (product intent, Bernardo 2026-07-10).

View File

@@ -17,6 +17,27 @@ Template:
---
## 2026-07-10 — #79 slice 3: Look & Feel Auto theme menu (#79 complete)
- **Task:** BACKLOG #79 slice 3 — the menu; completes the feature.
- **Did:** `rofi.nix` — "Auto theme (on/off)" row in Look & Feel + an
`autotheme)` submenu: toggle, pick day/night (from
`nomarchy-theme-sync list`), set sunrise/sunset (HH:MM input, validated).
Enable writes the flag + defaults the summer pair `--no-switch`, then
`exec auto --force` — one rebuild installs the timer AND applies the right
theme. Disable is instant `--no-switch` (`auto` self-gates; the lingering
timer no-ops). Day/night/times are live `--no-switch`.
- **Verified:** **V1** — HM generation builds (`writeShellScriptBin` bash -n
on nomarchy-menu passes) + bash -n on the built menu. **Logic test**
(stubbed rofi/theme-sync/notify): selecting "Auto theme (off)" runs exactly
`set day summer-day`, `set night summer-night`, `set enable true`
(all `--no-switch`), then `auto --force` — the intended one-rebuild path.
Disable path is static-clear (set false `--no-switch`, no `auto`); a
stateful-stub dynamic test would loop (stub doesn't reflect the flip). V0
flake check green. **#79 collapsed to `[blocked:hw]`** (all 3 slices done;
only live-session switch remains, needs a Nomarchy machine).
- **Pending:** V3 real-session (timer switches day↔night across sunset).
- **Next suggestion:** NEXT head #76/#79 both `[blocked:hw]`; QA/PROPOSED.
## 2026-07-10 — #79 slice 2: auto-theme systemd timer
- **Task:** BACKLOG #79 slice 2 — the timer/hook.
- **Did:** `modules/home/autotheme.nix` (imported in home default.nix):