After 3⅓ years of putting up with my last solution, I've finally got a better one. This is for LXDE, and other DEs based on Openbox.
Install
brightnessctl(which should also come with abrightness-udevpackage):wizzwizz4@mylaptop:~$ sudo apt install brightnessctlCheck whether you're in the
videogroup:wizzwizz4@mylaptop:~$ groups wizzwizz4 cdrom floppy sudo audio dip video plugdev netdev bluetooth lpadmin scannerIf you're not in the
videogroup, add yourself to it and then log in again.wizzwizz4@mylaptop:~$ sudo usermod -aG video wizzwizz4 wizzwizz4@mylaptop:~$ lxsession-logoutRun
xevto work out what your brightness keys are called:KeyRelease event, serial 50, synthetic NO, window 0x2a00001, root 0x78a, subw 0x2a00002, time 3706596, (39,62), root:(127,354), state 0x0, keycode 233 (keysym 0x1008ff02, XF86MonBrightnessUp), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False KeyPress event, serial 51, synthetic NO, window 0x2a00001, root 0x78a, subw 0x2a00002, time 3709488, (39,62), root:(127,354), state 0x0, keycode 232 (keysym 0x1008ff03, XF86MonBrightnessDown), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: FalseOn my machine, and probably everybody else's too, they're called
XF86MonBrightnessUpandXF86MonBrightnessDown, so you can probably skip to step 3.Edit
~/.config/openbox/lxde-rc.xml. Inside the<keyboard>section (probably at the end of it, just before</keyboard>), add the following:<!-- Change the brightness --> <keybind key="XF86MonBrightnessUp"> <action name="Execute"><command>brightnessctl set 6.25%+</command></action> </keybind> <keybind key="XF86MonBrightnessDown"> <action name="Execute"><command>brightnessctl set 6.25%-</command></action> </keybind>Adjust to taste. I like the
-eflag that comes with Debian 11 (Bullseye).Make sure you actually pressed save. (I always forget this step.)
Run
openbox --reconfigureto reload Openbox's configuration. (Or restart your computer – but I think this is easier.)
Tada!
Note that brightnessctl doesn't come with Wheezy; it was first introduced in Debian 10 (Buster). If you're using an older Debian, you can write a short script to increment / decrement the value stored in the relevant /sys/class/ file, and setuid root it.