repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

docs: design transactional DDC setup

366b38fba7edd104457f98d93a0adaa22d4cfe7b

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (1)

+45 / −0 text lines

Diff layout

quickshell/nuguland/docs/super/specs/2026-07-11-ddc-setup-design.md

Added
new file mode 100644

+45 / −0 text lines

1# ddc setup design
2
3## goal
4
5Turn brightness DDC setup from an opaque detached command into a transactional, observable setup and control flow.
6
7## system contract
8
9Use Arch's `ddcutil` package as the persistent system integration. Its package owns `/usr/lib/modules-load.d/ddcutil.conf` and `/usr/lib/udev/rules.d/60-ddcutil-i2c.rules`; Nuguland must not duplicate these under `/etc`.
11The privileged stage installs `ddcutil`, loads `i2c-dev` for the current session, and retriggers i2c udev devices. All later detection, reads, and writes run unprivileged.
13## stages
151. `preflight`: inspect command availability, module state, device presence, and permissions.
162. `authorize`: request Polkit only when package/session setup is incomplete.
173. `install`: run the bounded package-native setup command and capture exit status.
184. `detect`: run `ddcutil detect --brief`; map DRM connectors to I2C buses.
195. `read`: run `ddcutil getvcp 10 --brief` per detected bus and record current/max brightness.
206. `verify`: expose only displays that responded successfully as controllable.
217. `ready`: retain detected display state and collapse setup UI to a compact `ddc ready` status.
23## UX
25The expanded setup card shows every stage with `waiting`, `running`, `done`, or `failed`, one progress indicator, concise detail, detected displays, retry, close, and copy-diagnostics actions.
27When every stage is green, the setup card collapses. It can be reopened for diagnostics. Display rows show connector, monitor name, bus, current brightness, and readiness.
29No stage silently disappears. Running actions disable duplicate submission. Errors identify the failed stage and offer retry from that stage.
31## errors and diagnostics
33Capture process stdout/stderr internally but expose only bounded, redacted summaries. Never include passwords, environment variables, or arbitrary command lines. Diagnostics include stage, exit code, package/module/device/permission state, connector, bus, and sanitized ddcutil message.
35Timeouts are explicit for detection, reads, and writes. One failed monitor does not disable working monitors. Setup cancellation leaves completed package-native changes intact and reports cancellation.
37## control
39DDC display writes call `ddcutil --bus <n> setvcp 10 <percent>` without root. Successful writes update the row and OSD; failures preserve the previous value and surface an inline error.
41## tests
43Pure JavaScript owns parsing and stage shaping. Tests cover detect parsing, VCP parsing, stage transitions, partial-monitor failure, redaction, timeout/error shaping, collapsed-ready state, and command argument generation.
45QML tests verify Process-based setup replaces `execDetached`, setup feedback is rendered, and DDC writes use detected buses. Final gates: `just fmt`, `just test`, `just lint`.