feat(control-center): battery charge-limit as a preset toggle
All checks were successful
Check / eval (push) Successful in 3m10s

The "Battery Limit" entry was a raw number prompt; make it a proper
toggle picker — Off / 80% (recommended) / 90% / 60% / Custom… — writing
settings.power.batteryChargeLimit. Kept in the control-center, where the
baked rebuild-valued System Toggles live (the rofi nomarchy-menu is the
instant surface; the CC holds config values), and reachable from the menu
via System › Control Center. Base machinery (the sysfs oneshot + AC-replug
udev in power.nix) is unchanged, so it lands on the next sys-rebuild like
its siblings.

Instant-effect (no rebuild) is refiled in BACKLOG § PROPOSED as
[blocked:hw]: it needs a udev-writable threshold node, confirmable only on
a laptop with the control.

Verified: V0 (bash -n; nix flake check --no-build, green) + V1
(nomarchy-control-center package builds — the writeShellApplication
shellcheck gate passes). Session spot-check queued in HARDWARE-QUEUE.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-07 19:06:15 +01:00
parent ce89fddab6
commit d078ba2a82
4 changed files with 69 additions and 22 deletions

View File

@@ -247,22 +247,20 @@ job: the `checks.*` VM suite + real toplevel/HM builds on every push
*Agents: append here with a one-paragraph pitch (what/why/cost). Do not
implement. Bernardo moves accepted items into a tier.*
- **Battery charge-limit as a quick toggle** (Raised by Bernardo,
2026-07-07). The base already ships: `nomarchy.system.power.
batteryChargeLimit` writes `charge_control_end_threshold` via a
systemd service (+ a udev re-trigger on AC plug), with a "Battery
Limit" control-center entry and a `battery-charge-limit` VM check.
The gap is UX: today it's a *type-a-number* NixOS option that needs a
`sys-rebuild` to change. Bernardo wants a **toggle** for the charging
threshold — i.e. a one-click "conservation mode" (cap ~80% ↔ full
100%) rather than entering a value. Ideally instant-effect: the
service already `echo`es the threshold to sysfs, so a toggle could
write the live value + persist to `settings.power.batteryChargeLimit`
(night-light `--no-switch` pattern) instead of rebuilding, and
surface it prominently (menu row and/or a Waybar quick action).
Decide: keep the number-entry for the exact cap AND add an on/off
quick toggle, or replace with a fixed-cap toggle. Cost: small — mostly
a menu/writer + making the write instant; the sysfs mechanism exists.
- **Battery charge-limit — make the toggle instant** `[blocked:hw]`
(follow-up to the preset toggle shipped 2026-07-07, iteration #55).
The control-center now has a proper toggle (Off / 80% / 90% / 60% /
Custom…) writing `settings.power.batteryChargeLimit` — but that's a
baked NixOS option, so it only lands on the next `sys-rebuild`. To make
it instant (no rebuild): add a udev rule making
`/sys/class/power_supply/BAT*/charge_control_end_threshold`
group-writable (`MODE`/`GROUP`) so the menu can `echo N >` it live
alongside persisting state (the sysfs oneshot in power.nix still owns
boot + AC-replug re-apply), and/or surface a rofi-menu quick row or a
Waybar action. `[blocked:hw]`: the sysfs write + no-rebuild effect can
only be confirmed on a laptop exposing the threshold. Decide first
whether the small privilege grant (a local user can set the charge cap)
is acceptable.
- **Portal/Flatpak camera picker still lists the internal IR sensor**
(ROADMAP § Webcam follow-up). The shipped IR-hide is a *WirePlumber