brightness: match monitors by DRM connector, per-monitor setProc#190
Open
kanikamaxxing wants to merge 1 commit into
Open
brightness: match monitors by DRM connector, per-monitor setProc#190kanikamaxxing wants to merge 1 commit into
kanikamaxxing wants to merge 1 commit into
Conversation
Two related bugs that combined to make per-monitor brightness sliders unusable on multi-monitor setups where Quickshell.screens and ddcutil's detect order disagree: 1. The shared setProc was a single Process instance reused across all BrightnessMonitor instances. Concurrent setBrightness calls from different sliders would overwrite each other's command before startDetached fired, so the last-written command wins and the other slider's change is lost. Each BrightnessMonitor now owns its own setProc. 2. ddcEntry matching only used screen.model (which can be stripped of the manufacturer prefix that ddcutil includes) and otherwise fell back to first-unused-bus order. When Quickshell.screens enumerates monitors in a different order than ddcutil, the fallback cross-wires the sliders: the slider for screen A controls ddc-bus B and vice versa. Now matches the DRM connector first (entry.drmConnector.endsWith(screen.name)), which is the most reliable cross-reference, then falls back to model match, then to the existing first-unused-bus heuristic. Together: the slider on each monitor now controls its own monitor's brightness deterministically regardless of screen enumeration order or simultaneous use.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related bugs that combined to make per-monitor brightness sliders unusable on multi-monitor setups where
Quickshell.screensandddcutil detectenumerate monitors in a different order.Bug 1 — shared
setProcracesetProcwas a singleProcessdeclared at theBrightnessSingleton root, shared by everyBrightnessMonitor. When two sliders firedsetBrightnessnear-simultaneously, the secondsetProc.command = …overwrote the first beforestartDetached()had executed, so the first monitor's brightness change never reachedddcutil.Bug 2 —
ddcEntrymatching cross-wires slidersThe
ddcEntrylookup triedscreen.modelfirst, then fell back to first-unused-bus order. Quickshell'sscreen.modelcan be the bare model name whileddcutilincludes a manufacturer prefix (e.g.H27T6vsSKG H27T6), so the model match often fails. WhenQuickshell.screensenumerates monitors in a different order thanddcutil detect, the first-unused-bus fallback then assigns eachBrightnessMonitorto the wrong DDC bus — slider for screen A controls bus B and vice versa.Changes
setProc— eachBrightnessMonitornow owns its ownProcessso concurrent slider changes don't overwrite each other's command.ddcutil detect --briefalready emitsDRM connector: card0-DP-1; we now parse that intoentry.drmConnectorand matchentry.drmConnector.endsWith(screen.name)as the primary lookup. This is the most reliable cross-reference back to aShellScreenand avoids both the model-prefix mismatch and the screen-order fallback.Test plan
— robin