Software: Beratung und Entwicklung

Screen brightness without xfce4-power-manager in Ubuntu 15.10 XFCE4 Desktop

Since Ubuntu 15.10 I had several problems with my ACER Aspire E 17 laptop:

  1. it hung on shut down - sometimes
    After unplugging the power connector the laptop shut down - might take some time

    2. the power manager indicator app in the panel leaked memory - all of my 8GB of RAM got occupied after a couple of hours. Using "free -s2" I could see the free memory decreasing. After killing the xfce4-power-manager process the memory was freed again. If I didn't switch on the indicator app, the memory was not occupied.

The leaking of memory was already filed as a bug and - as I understood - was also fixed. Unfortunately, for me it was still leaking the memory in Ubuntu 15.10.
So this indicator app is currently unusable for me.

However, I also was getting bored because the laptop hung on shut down. Without the power plugged in, it shut down as expected. So I removed the XFCE4 power manager.

After the removal I was unable to set the brightness of my display. I search the Internet and found tools like *xbacklight* and others I don't remember any more. None of them worked on my Acer laptop.

So I decided to write a little Python 2.7 script that can be assigned to keyboard strokes. Now I am able to set the brightness of the display using the configured key shortcuts.
This is what to do...

  1. Ensure that the brightness can be set using the sysfs file system

    $ ls -l /sys/class/backlight lrwxrwxrwx 1 root root 0 Apr 10 13:28 intel_backlight -> ../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight $ cd /sys/class/backlight/intel_backlight $ ls -l drwxr-xr-x 3 root root 0 Apr 10 13:28 ./ drwxr-xr-x 4 root root 0 Apr 10 13:28 ../ -r--r--r-- 1 root root 4096 Apr 10 13:28 actual_brightness -rw-r--r-- 1 root root 4096 Apr 10 13:28 bl_power -rw-r--r-- 1 root root 4096 Apr 10 14:25 brightness lrwxrwxrwx 1 root root 0 Apr 10 13:28 device -> ../../card0-eDP-1/ -r--r--r-- 1 root root 4096 Apr 10 13:28 max_brightness drwxr-xr-x 2 root root 0 Apr 10 13:28 power/ lrwxrwxrwx 1 root root 0 Apr 10 13:28 subsystem -> ../../../../../../../class/backlight/ -r--r--r-- 1 root root 4096 Apr 10 13:28 type -rw-r--r-- 1 root root 4096 Apr 10 13:28 uevent

    As you can see the file actual_brightness and max_brightness are read-only.

    One can only write the file brightness. Writing another valid value to this file changes the brightness of the display.

    To test whether the brightness can be controlled this way write another valid value to the file:

    $ cat /sys/class/backlight/intel_backlight/max_brightness 187 $ cat /sys/class/backlight/intel_backlight/actual_brightness 25

    A valid value of 50 will change the display brightness.

    $ sudo su - # cd /sys/class/backlight/intel_backlight # echo 50 > brightness # exit

    This part is working if the brightness has increased.

    2. Copy the Python script file to the /bin directory or wherever you what to put this script.
    \\ $ sudo cp /bin $ sudo chmod +x /bin/

    Now test whether the script is working.
  • Optionally you may edit the script and uncomment 3 lines (line 83-85) to see if the script can read the brightness values. The exit(0) line will ensure that nothing will be written.

    3. Enable the script to be executed by all users.

    Therefore edit the file /etc/sudoers.

    Add the following line near the end of the file:

    ALL ALL=NOPASSWD: /bin/*

    Now any user can execute the script using the following syntax:

    $ sudo /bin/ -v 5

    4. Somehow make the system to execute this file when a configured key combination is used.

    The easiest way to achieve this is creating a keyboard shortcut using the menu Preferences / Keyboard

    To increase the brightness use

    $ sudo /bin/ -v 5

    To decrease the brightness use

    $ sudo /bin/ -v -5

    The value for the "-v" parameter may be increased to increase the change of brightness.

For me this works sufficient.


Last modified by Administrator on 2016/04/10 16:43
A Java based generic database utility with configurable content. Database browsing, charts, console, etc. Visit...
A logging framework for the Oracle© database. Visit...
An entity relationship modelling tool. Visit...

This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise - Documentation