Repository navigation
[ryoku] shell: keep the backlight fader off non-backlight devices - #761
Open
techapostle wants to merge 1 commit into
Open
techapostle wants to merge 1 commit into
techapostle wants to merge 1 commit into
Conversation
On a desktop with no /sys/class/backlight device, ryoku-hw-backlight
prints nothing, so `${BL:+-d "$BL"}` drops -d and brightnessctl falls
back to its first device of any class. Here that was a keyboard LED
(input16::compose,leds,0,0%,1): the read parsed 0, backlightAvailable
went true, and Controls, the bar brightness widget and the Kairos and
Orpheus display pages offered a "Built-in display" fader that wrote to
the LED.
Both the read and the write now pass `-c backlight`. With no backlight
brightnessctl exits 1 with no output, backlightPct stays -1 and the
fader hides, as the comment on backlightPct already says it should. On
a laptop the selector's device is in the backlight class, so the call is
unchanged.
Note: Fixed: desktops without a built-in screen no longer show a fake Built-in display brightness slider
This branch has not been deployed
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.
What changed
On a desktop with no built-in screen, Controls shows a "Built-in display" brightness fader in the Brightness drawer, and the bar brightness widget and the Kairos and Orpheus display pages count it as a display. Dragging it writes to a keyboard LED.
Cause.
services/Devices.qmlresolves the panel withryoku-hw-backlight, which exits 1 and prints nothing when/sys/class/backlightis empty.${BL:+-d "$BL"}then drops-d, and brightnessctl falls back to its first device of any class:The read parses
0, sobacklightPctbecomes 0 andbacklightAvailableturns true. The comment onbacklightPctsays the reader should never set it on such a machine.Fix. The read and the write in
Devices.qmlboth pass-c backlight. With no backlight, brightnessctl exits 1 with no output (Failed to read any devices of class 'backlight'.), sobacklightPctstays -1 and every consumer ofbacklightAvailablehides the fader. On a laptop the selector's device is already a backlight-class device, so-c backlight -d <it>resolves the same device as before. If the selector is missing, the class still keeps brightnessctl on a backlight.Area
ryoku
How it was tested
Arch, Hyprland 0.57.0, desktop with no
/sys/class/backlightdevice and two DDC monitors.blReadcommand before the change prints0; after it prints nothing.brightnessctl -c backlight -p set 50%exits 1 and leaves the LED untouched.-cand-dcombine as expected:brightnessctl -c leds -d input16::compose -mfinds the device.Devices.qml: before the change, Controls > Brightness drawer listed Built-in display, DP-1 and HDMI-A-1. After it, the drawer lists only DP-1 and HDMI-A-1, and the main Brightness slider still follows DP-1.Not tested: a laptop with a real backlight. The argument rests on brightnessctl's class filter:
-c backlight -d <name>resolves a device whose class is backlight, andryoku-hw-backlightonly ever prints entries from/sys/class/backlight.Checklist
[area] scope: summarycommit subject.CHANGELOG.mdupdated in the area I touched.--no-verify.luac -p), shell scripts passbash -n, and QML passesqmllintwhere applicable.