question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Let user choose which backlight device is controlled by brightness slider

See original GitHub issue

Is your feature request related to a problem? Please describe. My computer (an Apple MacBookPro16,1) has two backlight devices:

$ ls /sys/class/backlight/
acpi_video0  amdgpu_bl0

“acpi_video0” is the one that actually controls my display backlight, while “amdgpu_bl0” does nothing. When nwg-panel calls light, it selects the amd backlight by default, so the brightness slider in my panel’s controls menu doesn’t do anything.

Describe the solution you’d like

I would like some way to set the backlight device that is used so that I can set it to control the “acpi_video0” backlight. This could probably be done by adding a dropdown menu that lets you select from the outputs of

$ ls /sys/class/backlight`
acpi_video0 
amdgpu_bl0

If a specific backlight is selected, -s sysfs/backlight/<SELECTED_BACKLIGHT> could be added to light’s arguments, or -d <SELECTED_BACKLIGHT> to brightnessctl

This dropdown to select device could be located above “output switcher” and to the right of “Brightness” in this screenshot: image

Describe alternatives you’ve considered Alternatively, the slider in the panel’s controls thing could be set up to change the brightness of all display backlights in the system.

Additional context

light is called to set brightness here in the code https://github.com/nwg-piotr/nwg-panel/blob/97e2cc0ee8e5f050d92a74434978d6bd71496cd2/nwg_panel/tools.py#L432

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nwg-piotrcommented, Jan 25, 2022

Thanks! I expected something to be missed, as it was late in the night. I’ll add this.

0reactions
Redecoratingcommented, Jan 25, 2022

It ends up setting the brightness correctly, but then it resets it to the brightness that the default backlight has, which I think is because device seems to not be set when get_brightness is called.

diff --git a/nwg_panel/modules/controls.py b/nwg_panel/modules/controls.py
index 35a96f3..7a35879 100644
--- a/nwg_panel/modules/controls.py
+++ b/nwg_panel/modules/controls.py
@@ -191,7 +191,7 @@ class Controls(Gtk.EventBox):
             self.bt_label.set_text(name)
 
     def update_brightness(self):
-        value = get_brightness()
+        value = get_brightness(device=self.settings["backlight-device"])
         icon_name = bri_icon_name(value)
 
         if icon_name != self.bri_icon_name:

this change makes it work perfectly

Read more comments on GitHub >

github_iconTop Results From Across the Web

Manually Adjust The Minimum Backlight Brightness on ...
Right-click on the battery icon in system tray of taskbar and then click Adjust screen brightness option to open Power Options window. At...
Read more >
Backlight - ArchWiki
brightness is controlled by either the ACPI, graphic or platform driver. In this case, backlight control is exposed to the user through /sys/ ......
Read more >
How to Fix Windows 10 Screen Brightness Control Not Working
There are several ways to fix the Screen brightness problem on Windows 10. When you are experiencing this proplem, the screen brightness may ......
Read more >
399646 – Brightness control adjusts the wrong backlight ...
FN-keys to adjust the display brightness the OSD shows up and the sliders change, but the display brightness does not.
Read more >
Hummer12007/brightnessctl: A program to read and ... - GitHub
This program allows you read and control device brightness. Devices, by default, include backlight and LEDs (searched for in corresponding classes). If omitted, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found