A workaround for screen backlight change delays

This article is for you if you’re one of the many unlucky laptop owners who are faced with unbearable delays while changing screen brightness (it can take several seconds for screen brightness to change after pressing the function key responsible for changing brightness).

I wasn’t able to locate the source of this problem, nor fix it with any available online resources, of which there are many (e.g. here, here, or here. Thus, to avoid further frustration, I decided to use xbacklight (which works without any delays) and assign it to a different key combination.

Installing xbacklight

In order to use xbacklight, you may first need to install it from your distribution’s repositories. In the case of Arch Linux, you’ll need the extra/xorg-xbacklight package.

Setting backlight with xbacklight is straightforward:

xbacklight -set 15 # set to 15%
xbacklight -get    # get current brightness
xbacklight -inc 5  # increase by 5%
xbacklight -dec 5  # decrease by 5%

Brightness varies from 0 (no backlight) to 100 (maximum brightness).

If you’re interested in a slightly neater solution, I recommend reading my previous post about perceived brightness. This way you may be able to achieve linear brightness change and get more fine-grained control over low backlight levels.

Assigning key bindings

You can either assign key bindings globally using the .xbindkeysrc configuration file, or in some way specific to your window manager of choice.

I personally prefer .xbindkeysrc for such bindings, because if I ever decide to abandon Openbox and use e.g. Enlightenment, I’d probably like to retain them.

If you choose .xbindkeysrc, open it with your preferred text editor and append the following lines:

"xbacklight -inc 10"
    m:0x4 + c:111
    Control + Up

"xbacklight -dec 10"
    m:0x4 + c:116
    Control + Down

Or, if you have your own brightness changing script (e.g. from the neater solution I mentioned before), replace the lines in quotes with the path to your script.

The configuration above assigns Ctrl + Up and Ctrl + Down (where Up and Down are the up and down arrow keys). However, if you favour some other key combination, launch xbindkeys -mk, press the desired key combination and copy the resulting configuration to your .xbindkeysrc.

Afterwards, run xbindkeys to reload configuration from .xbindkeysrc and you’re good to go. This configuration should also be applied automatically every time you launch Xorg.