Sound and Power: follow volume and brightness changes made elsewhere #42
No reviewers
Labels
No labels
breadbug
bug
displays
enhancement
keybinds
network
phase-1
power
privacy
recovery
search
snapshots
sound
ui
ux
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Breadway/bos-settings!42
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/live-sound-brightness"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The Sound page read PipeWire state once on mount, so volume keys, the bar OSD or another mixer left it stale and the next drag jumped from the old value. Power had the same pattern for brightness (checked by reading the code: it also read once).
Sound. New
watch_soundcommand starts a singlepactl subscribewatcher per process (restarts itself if PipeWire or pactl goes away) and emits a coalescedsound-changedevent (150 ms) forchange/new/removeonsink,source,serverandsink-input; card, client and module chatter is ignored (is_relevant_event, 3 unit tests). The Sound page invokes it on mount and re-reads on each event.Power. New
get_brightnesscommand; the page polls it every 2 s while the window is visible, and refreshes battery readings roughly every 10 s.No fighting the user.
liveGate(frontend/src/lib/liveGate.ts,liveGate.test.mjs): an external read never replaces a slider that is being dragged or was moved in the last 700 ms (the read-back echo of the user's own change); a blocked Sound read is retried after 800 ms so nothing is lost.Manual test checklist (UI not run, by instruction)
wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.77(or press a volume key): the slider and percentage follow within a fraction of a second.Verification:
npm run check(0 errors, 0 warnings),npm run build,node --experimental-strip-types frontend/src/lib/liveGate.test.mjs,cargo fmt --all -- --check,cargo clippy --all-targets --locked -- -D warnings,cargo test --locked(78 passed).Closes BSET-31