Skip to content

daemon/actions/dimdisplay: Set brightness separately per display

Jakob Petsovits requested to merge work/jpetso/brightness-dimming-crutch into master

With 6.2's per-display brightness changes, setBrightness() under Wayland will, in many setups, affect multiple displays with different perceived screen brightness for a given brightness percentage.

Before this patch, the DimDisplay action would only remember a single brightness value (of the first display) and then set this value to potentially multiple displays when dimming stops again. This would lead to brightness transitions like this:

  • internal display: 50% -> dimmed 15% -> 50%
  • external display: 100% -> dimmed 15% -> 50%

Instead, dimming adjustments should apply to each display individually, like this:

  • internal display: 50% -> dimmed 15% -> 50%
  • external display: 100% -> dimmed 30% -> 100%

This commit makes it work that way. Non-dimmed brightness values are stored in a map, one value for each display that was connected at the time the dimming started. When restoring, these individual brightness values will be restored to all displays that are still connected.

This brings the original DimDisplay code in line with the new per-display brightness API. It still won't save you from bugs about dimming changes while one of your displays is disconnected. PowerDevil issue #38 provides a more comprehensive plan for making multi-monitor dimming with disconnections actually robust.

BUG: 493111

Merge request reports