Skip to content

fix(brightness): honor explicit backlight mapping fallback - #4056

Open
Nivella-Raven wants to merge 1 commit into
noctalia-dev:mainfrom
Nivella-Raven:fix/explicit-platform-backlight-mapping
Open

fix(brightness): honor explicit backlight mapping fallback#4056
Nivella-Raven wants to merge 1 commit into
noctalia-dev:mainfrom
Nivella-Raven:fix/explicit-platform-backlight-mapping

Conversation

@Nivella-Raven

@Nivella-Raven Nivella-Raven commented Aug 22, 2026

Copy link
Copy Markdown

Summary

  • Fall back to the configured per-output backlight_device when automatic DRM/sysfs connector discovery cannot match a backlight to an active output.
  • Keep automatic connector resolution unchanged when it succeeds.
  • Continue honoring none and ddcutil backend preferences during fallback selection.

Motivation

Platform backlights do not necessarily have a DRM connector in their sysfs ancestry. On a ClockworkPi uConsole, the internal display uses this topology:

Wayland output: DSI-2
Backlight: /sys/class/backlight/backlight@0
Resolved device: /sys/devices/platform/backlight@0/backlight/backlight@0
Driver: ocp8178-backlight

The output is explicitly configured:

[brightness.monitor.DSI-2]
backend = "backlight"
backlight_device = "/sys/class/backlight/backlight@0"

However, backlight enumeration currently skips the device when automatic connector resolution fails, before consulting backlight_device. This means the explicit mapping cannot recover from the missing DRM ancestry.

This change consults active outputs for a matching explicit device only after automatic discovery fails. The selected candidate remains marked as a fallback rather than an exact DRM match.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Build / packaging

Related Issue

Related context: #1898, #1899, and #3160.

Testing

Commands run on current main:

just format
just configure
just build
just test
git diff --check

Results:

  • Formatted with clang-format 22.1.8.
  • Full test suite passed: 91/91 tests.
  • The identical source change was applied to the v5.0.0-beta.9 release, built as an aarch64 release package, and installed on Arch Linux ARM.
  • Verified on a ClockworkPi uConsole under Niri 26.04. Brightness adjustment works after restart.
  • Startup logs confirm the fallback path:
[brightness] using explicitly configured backlight 'backlight@0' for connector DSI-2
[brightness] found backlight candidate 'backlight@0' type='raw' current=11% connector=DSI-2 match=fallback
[brightness] selected backlight 'backlight@0' type='raw' connector=DSI-2 match=fallback

Manual Coverage

  • Tested on Niri
  • Tested on Hyprland
  • Tested on Sway
  • Tested on another compositor:
  • Tested with different bar positions and density settings
  • Tested at different interface scaling values
  • Tested with multiple monitors

Screenshots / Videos

Not applicable; this change has no visual UI component.

Checklist

  • This PR is ready for review, or it is marked as Draft.
  • I read and followed the relevant guidance in CONTRIBUTING.md.
  • I ran just format with clang-format v22+ installed, or this PR has no code changes.
  • I ran the relevant build or test commands, or explained why they were not run.
  • I self-reviewed the changes.
  • I checked for new warnings or errors.
  • I will update end-user documentation after merge, or this PR does not change user-facing configuration or behavior.
  • I added or updated assets/translations/en.json, or this PR adds no new user-facing strings.
  • I did not edit non-English translation files unless this PR is explicitly for translation tooling, an import/export sync, or a maintainer-requested locale change.
  • I used the existing canonical names for config keys, IPC names, paths, and identifiers.

Additional Notes

No new configuration key or user-facing string is introduced. This fixes fallback handling for the existing per-monitor backlight_device option.

Use the configured per-output backlight device when automatic DRM/sysfs connector discovery cannot match a platform backlight to an active output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant