A Guide to get Screen Brightness adjustments to work in LXDE

Hi All,

I don’t know if many people use LXDE but I happen to use it on a netbook with 2gB RAM and it works brilliantly. I had to get a few things sorted out after install. These were things like automatically showing the last user name at the login prompt, setting DNS on the WIFI etc. The most annoying one was, LXDE did not have a screen brightness adjustment option nor did the hot keys for it work. To add to my frustration, xbacklight couldn’t fix it either. After a lot of research, I found a way to allow screen brightness adjustments:

  1. The screen brightness is controlled via a number in the file: “/sys/class/backlight/<folder name, e.g. intel_backlight/brightness”. But the default permissions won’t allow to write to it without sudo. This means even if you set a keyboard shortcut to set this number, it won’t work.
  2. To add write + execution permission, I did
sudo chmod -c -v a+x+w /sys/class/backlight/intel_backlight/brightness

. Note: the -c-v flag is to show verbose.

  1. The next step was to formulate a bash script which I could assign to my brightness control keys. I wanted an elegant solution, I.e. not having two bash script files (one for increasing brightness, decreasing etc.) that needs to be called all the time. This is how I achieved it.
  2. First set up a hotkey for increasing the brightness (choose any combination) in the lxhotkey window as an execute-command option. Then add this command
bash -c "while read name; do  bash \-c \"echo \$((name+100)) >  /sys/class/backlight/intel_backlight/brightness\";done <  \"/sys/class/backlight/intel_backlight/brightness\""

. Note your folder may differ from intel_backlight and depending on your laptop, your brightness might run from 0-8 but mine goes from 0-2400, hence I increase the brightness at a step of 100 (see $name+100). You need to chose your preference here.

  1. Similarily, repeat step 4 but this time choose your decrease brightness keys and add the same script with the following change:

I think this makes sense, it took me a while to figure this out and the internet eventually proved helpful so I hope this helps you save time/frustration.


As this is a “how to” rather than a request for help, I’ll move it to the ‘Unreviewed How To and FAQ’ sub-forum.