Skip to content

Universal brightness with xrandr#599

Open
aglairdev wants to merge 3 commits intogh0stzk:masterfrom
aglairdev:brightness-desktop
Open

Universal brightness with xrandr#599
aglairdev wants to merge 3 commits intogh0stzk:masterfrom
aglairdev:brightness-desktop

Conversation

@aglairdev
Copy link
Copy Markdown

Adds sxhkd keybindings to increase and decrease desktop monitor brightness using the BrightnessDesktop script.

@gh0stzk
Copy link
Copy Markdown
Owner

gh0stzk commented Feb 20, 2026

Sorry for the delay, im just check the script, works fine.

Could this method replace the current method that uses brightnessctl? I don't remember the package name right now.

I've only been able to test it on a desktop machine; I left my laptop at a friend's house and don't have it with me right now. But I assume it also works for laptops, right?

If so, I like the idea of ​​not depending on an extra package and using xrandr.

Beyond that, one problem I saw is that it depends on OUTPUT="HDMI-0"

This is a problem for a multi-monitor setup. A possible solution would be to use bspc query -M -m focused --names

and get the name of the monitor that is focused.

Could you make the changes? Once the changes are made, I'll push them to your pull request.

Also, instead of using Super + Up, Down, it could stay as it is with the specific keys for brightness control: XF86MonBrightness{Up,Down}

@aglairdev
Copy link
Copy Markdown
Author

I've updated the Pull Request with the following improvements:

  • Unification: The original Brightness script now uses the xrandr method. This enables brightness control on both Laptops and Desktops without relying on hardware-specific packages like brightnessctl.

  • Dynamic Detection: I added bspc query -M -m focused to automatically adjust brightness on the monitor that currently has the focus. This resolves the hardcoded HDMI-0 issue in multi-monitor setups.

  • Keybindings (sxhkd): I've restored support for the XF86MonBrightness keys. I also kept Super + Up/Down as a fallback; this is essential for desktop users with keyboards (such as 60% or TKL layouts) that often lack dedicated Fn or media keys for brightness.

  • Cleanup: I removed the BrightnessDesktop file and consolidated all the logic into the original Brightness script to keep the repository organized.

Tested on both desktop and laptop, working as expected in both scenarios

@aglairdev aglairdev changed the title Add desktop brightness keybindings Universal brightness with xrandr Mar 2, 2026
@gh0stzk
Copy link
Copy Markdown
Owner

gh0stzk commented Mar 10, 2026

Yes, thank you, I've been researching this.
From what I understand, the method you're suggesting, while it works well on all PCs, only modifies the gamma (software), which, in my opinion, is more of a visual filter than an actual brightness adjustment. I don't see a problem with this method on external monitors, but on laptops, power consumption will remain high, just as if the brightness were at 100%.

On desktops, it's a great method with no dependencies, pure and simple xrandr, and I love it, but laptop users won't benefit.

So let me think about what to do. I'm thinking we could use a variable. If the system has /sys/class/backlight, we could use the method with brightnessctl. If not, we could use the xrandr method, but then the problem would be for laptop users who connect an external monitor. Let me think about it.

@lord-pixc
Copy link
Copy Markdown

Hello, as a laptop user who uses a monitor, I have a suggestion. I'd venture to say that laptop users who use a monitor always do so with their laptop plugged into the charger, so using BrightnessDesktop script wouldn't be a problem in terms of power consumption. The issue arises when these users go outside and use their laptop without a monitor and probably without the charger.

So, why not also implement a feature that checks the MonitorSetup configuration before selecting a monitor? That way, if the user is using a monitor and charger, there's no problem, and if they don't have a monitor, there's no problem either. I'm new to this, so I hope I'm not saying something stupid.

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.

3 participants