feat(displays): display profiles — docked/undocked switching (item 15a)
All checks were successful
Check / eval (push) Successful in 3m4s

nomarchy.displayProfiles: named layouts for the same outputs, each a
list of nomarchy.monitors-style entries. The active profile lives in
the in-flake state (settings.displayProfile) on the night-light
pattern: nomarchy-display-profile apply <name> fires the baked hyprctl
rules instantly and writes the state with --no-switch; the next rebuild
bakes the profile's entries over nomarchy.monitors whole-by-name.
Monitor-rule composition is extracted to pure monitor-rules.nix
(renderer + 3-layer resolve, incl. a disable-guard so a stale menu
resolution pick can't resurrect a profile-disabled panel, and junk
state degrading to base config instead of an eval error) — because a
writeText/toFile state fixture is unreadable at flake-check eval time,
the new checks.display-profiles unit-tests the pure function directly.
Menu: System › Display gains a self-gated "Profiles ›" row (●/○ active
mark, Base layout to clear); commented template example + README row.

Verified: V0 (flake check, forcing the new check's asserts); V1 — a
scratch downstream through lib.mkFlake builds: the generated tool
passes bash -n with correct rules (disable/vrr/float scale), the baked
hyprland.conf shows the exact expected overlay, the menu renders, and
list/usage smoke-test clean. Remains: V3 live switching on a dock
(HARDWARE-QUEUE). Slices b (hotplug auto-switch) + c (workspace
binding) stay in item 15.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-07-05 17:52:19 +01:00
parent e02b4d8200
commit 9df18261f9
11 changed files with 271 additions and 43 deletions

View File

@@ -68,9 +68,10 @@ the *same* outputs. **Plan (designed 2026-07-05, iteration #27):**
`hyprctl keyword monitor <rule>` per entry (rules baked into the
dispatcher at build, like everything else in rofi.nix) + state write
+ toast. Outputs the profile doesn't name keep their base rules.
- **Slices:** (a) option + overlay + menu picker + template example
(opt-in ⇒ commented `templates/downstream/home.nix` block) — V1 +
a checks.* grep of the rendered hyprland conf, V3 real dock; (b)
- **Slices:** (a) ✓ shipped 2026-07-05 (iteration #28): option +
overlay (pure `modules/home/monitor-rules.nix`, unit-tested by
checks.display-profiles) + `nomarchy-display-profile` applier + menu
Profiles row + template example — V3 (real dock) queued; (b)
opt-in hotplug auto-switch: a socket2 watcher on monitoradded/
removed picks the profile whose named-output set matches connected
outputs (exact match, else largest subset, ties = no switch) —

View File

@@ -140,6 +140,14 @@ QA machine), the **T14s** (webcam case).
now reflects the real state (the `= true` comparison fix).
— 2026-07-04 Bernardo: PASS — theme changes committed and the
toggle self-committed.
- [ ] **Display profiles, slice a (item 15)** — declare two
`nomarchy.displayProfiles` (e.g. docked disables eDP-1 + arranges
the externals; undocked re-enables it), `home-update`, then:
System Display Profiles lists them (● marks active); applying
is instant (no rebuild) and survives a relogin (the baked
overlay); "Base layout" restores; a menu resolution pick made
earlier must NOT re-enable a profile-disabled panel after the
next rebuild.
- [ ] **Color picker (item 13, final slice)** — SUPER+CTRL+P (or Tools
Color picker): hyprpicker's zoom loupe appears; click a pixel →
toast shows the hex and `wl-paste` yields it; Esc cancels with no

View File

@@ -17,6 +17,32 @@ Template:
---
## 2026-07-05 — display profiles slice a (iteration #28, item 15a)
- **Task:** BACKLOG NEXT#15 slice a, per the #27 design: option +
overlay + applier + menu + template example.
- **Did:** nomarchy.displayProfiles (attrsOf (listOf monitorType));
monitor logic extracted to pure modules/home/monitor-rules.nix
(rule renderer + 3-layer resolve: profile replaces whole-by-name →
resolution picks field-level with the disable-guard → wildcard),
hyprland.nix consumes it and gains nomarchy-display-profile
(list/active/apply/base; apply = baked hyprctl rules + state write
--no-switch, base = clear + hyprctl reload) on PATH only when
profiles exist; menu: Display gains a gated "Profiles " row + new
display-profile mode (●/○ active mark, Base layout row); template
example + README row. checks.display-profiles unit-tests resolve
(incl. junk-state degradation) — the first HM-eval fixture attempt
hit "path not valid" (eval store won't realise writeText/toFile
under flake check), hence the pure-function extraction.
- **Verified:** V0 (check's asserts force at eval); V1 — scratch
downstream through lib.mkFlake builds: tool bash -n + correct baked
rules (disable, vrr, floats), hyprland.conf shows the exact overlay
(wildcard + kept base + disabled panel + profile output), menu bash
-n, list/usage smoke. Live switching needs a session+dock → V3.
- **Pending:** V3 queued. Slices b (hotplug auto-switch) and c
(workspace binding) remain in the item.
- **Next suggestion:** #16 greeter theming, or 15b if momentum on
displays is preferred.
## 2026-07-05 — display-profiles design pass (iteration #27, item 15, no code)
- **Task:** BACKLOG NEXT#15 — the entry itself demands "design first,
write the plan into this entry before coding". Backlog-only iteration.

View File

@@ -7,6 +7,11 @@ here the moment a debugging session teaches you something a future
iteration would otherwise rediscover.
## Testing & VM recipes
- A checks.* fixture CANNOT be a writeText/toFile state file read at
eval time ("path … is not valid" — flake check's eval store won't
realise it): extract the logic into a pure importable file and
unit-test THAT (monitor-rules.nix / checks.display-profiles is the
pattern).
- CI (`.gitea/workflows/check.yml`) is **eval-tier only**: the act_runner
is a docker container (no systemd, no /dev/kvm). Container gotchas are
documented in the workflow header (single-user Nix + nixbld users,