Controlling the screen brightness in Lubuntu 14.04

Source code can be found at the following link PyBrightControll.

Everything provided below is an explanation.

After reinstalling my Lubuntu 14.04 I ran into a new kind of “surprise”.

Keys for controlling the brightness stopped working. Well, I could see that pressing them made system to report about change but no real effect could be observed.

Many articles stated that it happened because of the driver for video card and solutions were pretty vary. Eventually I came up the solution that offered to control the brightness by echoing the value to one of config files.

This file is located at this path:  /sys/class/backlight/intel_backlight/brightness and it contains the current value of brightness.

The maximal value is contained in /sys/class/backlight/intel_backlight/max_brightness .

As noted above we can change it manually using such command:   “sudo echo 400 > /sys/class/backlight/intel_backlight/brightness

Let’s say you open the console and  check the current value of brightness and either decrease  or increase it.

Easy but boring.

We can automatise it so that we would just make a single click.

I used the following approach.

The first thing to note is that we need to modify files what belong to root. So we need root privileges. To execute script as root you get asked for the password every time when you run it. Not convenient.

So move the file to /usr/bin folder using the following command:

sudo mv  ~/ /usr/bin/    if it lies in your home directory.

The next security measure is to change permissions so that no one besides root would be able it.


sudo chown root:root  /usr/bin/  && sudo chmod 755 /usr/bin/

Now no one besides root will be able to edit it. This a good security measure.

We need allow passwordless execution of script  to do it edit sudoers file doing:

sudo visudo

add a new line to the bottom of file:

username ALL = NOPASSWD: /usr/bin/

Resulting file should look like this:


Exit and save the changes.

Try to execute:

sudo /usr/bin/backlight,py -d 200


sudo /usr/bin/backlight,py -i 200

You shouldn’t be asked for password and notice the changes. IF no then recheck whether you did all steps correctly or give up this way.

If it worked for you as it worked for me I guess you would like to have  keybinding for fast control of brightness.

Xbindkeys is a good tool for it. I bound to Ctrl+f4 and Ctrl+f5.

Result can be seen on video:


Leave a Reply

Your email address will not be published. Required fields are marked *