XFCE change brightness steps and/or change brightness key behavior

I'm trying to change the brightness steps in XFCE from 10 to 20. I'd like the ability to gradually change the laptop's brightness by 5% instead of 10%. Is there a way to set this up with a config file for XFCE?

If that is not an option, I have thought of another way: I know that I can disable XFCE's power settings from handling brightness keys, but setting up a shortcut in keyboard preferences does not seem to be able to override this.

Is there another way I can remap what XF86MonBrightnessUp and XF86MonBrightnessDown do when pressed? Specifically, I'd like Up to use the command lumeus +5% and Down to use the command lumeus -5%.

Can either idea be done while using XFCE with its XFWM?


Solution 1:

No need to recompile the xfce4-power-manager

There really is no need to recompile xfce4-power-manager.

Firstly, install xbacklight

$ sudo apt install xbacklight

Secondly, check whether you have control over the backlight.

$ xbacklight -1
$ xbacklight +5

Should these commands result in a No outputs have backlight property error, then follow these remediating steps before proceeding.

Once xbacklight -1 and xbacklight +1 work from the command line, proceed with assigning these commands to respectively the XF86MonBrightnessDown and XF86MonBrightnessUp keys. This is done by hitting those keys when asked by the Settings → Keyboard → Application Shortcuts application.

Finally, reboot for these changes to take effect.

Keyboard settings

Solution 2:

Another year passes and another year of no progress on this issue despite easy solutions posted online (e.g., How to obtain more brightness levels using Fn+keys in Xfce?).

You need to recompile Xfce Power Manager with minor changes in the code.

  1. Download Power Manager from here: http://archive.xfce.org/xfce/4.12/src/xfce4-power-manager-1.4.3.tar.bz2

  2. Unpack it and cd into the folder.

  3. Open common/xfpm-brightness.c in a text editor:  (e.g., gvim common/xfpm-brightness.c).

  4. Change line 515:

    set_level = MAX (hw_level/1.5, brightness->priv->min_level);
    
  5. Change line 475:

    set_level = MIN (hw_level*2 + (hw_level==0), brightness->priv->max_level );
    
  6. Save and close.

  7. Type ./configure at the command prompt. You're kind of on your own here... there will be errors and you need to fix them. E.g., on Xubuntu 18.04 I needed to install several things:

    sudo apt-get install libdbus-glib-1-dev
    sudo apt-get install libxfce4ui-1-dev
    sudo apt-get install libnotify-dev
    sudo apt-get install libupower-glib-dev
    
  8. Once configure is complete, type make.

  9. Once make completes, type sudo make install.

  10. Logout and login. Voilà! You have smaller backlight increments.

Solution 3:

Before downloading (step 1 above), check the version number:

xfce4-power-manager --version

Then download the correct version from here:

https://git.xfce.org/xfce/xfce4-power-manager

Last issue, I seem to run into a polkit error when running the custom xfce4 power manager (related to [this][1] but no fix).

[1]: Authentication needed to run xfpm-power-backlight-helper as super user https://forum.xfce.org/viewtopic.php?id=11190