Set brightness automatically at the startup in Linux

Categories: Linux, Python
Posted on: 25th September 2011 by: Ishan Thilina Somasiri

When ever I restart (or logout and login) my laptop the LCD display brightness is set to the maximum value. Even if I set the brightness settings in the power to the value I need, they won’t be in effect when I restart the machine.

 

To solve this problem I wrote the following python script. First you need to add it to the startup applications list. The command to be given in the startup applications is “python /<path>/<to>/<script>/setBrightness.py”.

 

By default, the script will set the brightness to the minimum value. But if you want to change this, you can do that by editing the value 0 of the “value” variable to any value between 0 to 100.

Download::

http://ishans.info/attachments/category/40/setBrightness.py

 

PS:

 

It seems that D-bus interfaces have been changed recently (From Gnome 3 onwards). So if you use Ubuntu 11.10 or any other gnome 3 compatible OS, please use the following script.

 

http://ishans.info/attachments/article/65/setBrightness.py

 

All of the above code can now be conveniently accessed from Git-hub via https://github.com/ishanthilina/setBrightness . There are branches for every version of the script.