XFCE Screen Brightness Issues

As I didn't want a full blown Desktop Environment like Gnome or KDE on my laptop (which is running ArchLinux), I went with XFCE.

It worked nicely out of the box, except for the screen brightness controls.

The hardware keys don't do anything at all by themselves except for firing an ACPI event. When XFCE is running the xfce-power-manager captures the key events and controls the brightness.

Unfortunately at first i had two brightness controls in /sys/class/backlight, named acpi_video0 and intel_backlight. The first had brightness levels from 0 to 9, which xfpm changed, unfortunately this control had no effect on the actual backlight. Using the acpi_backlight=vendor kernel parameter I got rid of the acpi_video0 directory though and xfpm worked nicely on controlling the brightness. Well, almost. There was this annoying fact that it only offered eleven linear brightness levels. After searching on the net for a while i decided to look at the source myself and found the cause rather quickly:

~/tmp/xfce4-power-manager (git)-[master] % ack 'brightness->priv->step ='
214:            brightness->priv->step =  max <= 20 ? 1 : max / 10;
357:    brightness->priv->step =  ret <= 20 ? 1 : ret / 10;
512:    brightness->priv->step = 0;

As you can see it would have been quite fine if the backlight had only 20 or less settings, unfortunately the intel_backlight brightness ranges from 0 to 976, so there's eleven rather crude brightness levels available with XFCE.

As quick workaround i changed the divider from 10 to 20. It's better now although I'd still prefer logarithmic steps.

$ yaourt -G xfce-power-manager
$ cd xfce-power-manager
$ makepkg --nobuild
$ nano src/xfce4-power-manager-1.2.0/common/xfpm-brightness.c
$ makepkg --noextract