Ubuntu – How to create keyboard shortcuts for screen brightness in Xubuntu (XFCE Ubuntu)

brightnesskeyboard shortcutsUbuntuxfcexubuntu

How to create keyboard shortcuts for screen brightness in XFCE?

Ideally the solution uses inbuilt functionality which does not additionaly drain the battery (by installing a service/daemon, etc)

Best Answer

You can use xbacklight to control the screen brightness. In XFCE, open the settings and add calls to xbacklight under “Keyboard” → “Application Shortcuts”: something like xbacklight -dec 5 -steps 1 for BrightnessDown and xbacklight -inc 5 -steps 1 for BrightnessUp.

A few graphics drivers don't support xbacklight. If it doesn't work on your system, you can ask about it on this site, mentioning your exact graphics card model.

A generic method that works with any desktop environment (or none at all) is to run xbindkeys (available in most distributions, including Ubuntu). Xbindkeys only consumes CPU when it starts up or when a key is pressed, and very little at that; it isn't a battery drain at all. (This would be the case for any remotely decent software providing the same functionality.) In ~/.xbindkeysrc, put something like

"xbacklight -dec 5 -steps 1"
  XF86MonBrightnessDown
"xbacklight -inc 5 -steps 1"
  XF86MonBrightnessUp

and add xbindkeys to your startup applications in your desktop environment, or to ~/.xsession or ~/.xinitrc if you don't use a desktop environment.

Related Question