Keyboard backlight

There are various methods to control the keyboard backlight brightness level.

Any vendor

There are a variety ways to manage the brightness level and different helpers tools to accomplish this, such as brightnessctl or light.

The sys pseudo-file system exposes an interface to the keyboard backlight. The current brightness level can be get by reading /sys/class/leds/tpacpi::kbd_backlight/brightness. For example to get the maximum brightness level:

$ cat /sys/class/leds/tpacpi::kbd_backlight/max_brightness

To set the brightness to 1:

# echo 1 > /sys/class/leds/tpacpi::kbd_backlight/brightness

When using brightnessctl you can get a list of available brightness controls with brightnessctl --list, then to show the kbd backlight information:

$ brightnessctl --device='tpacpi::kbd_backlight' info

This will show the absolute and relative current value and the maximum absolute value. To set a different value:

$ brightnessctl --device='tpacpi::kbd_backlight' set 1

xset

Some keyboard manufactores are not recognized by brightnessctl or light, but you can use xorg-xset to control its lights if you are running Xorg.

The first parameter led turns on the led, and turns it off, the parameters accepts integers for 1 to 32 (each number corresponds to a led in you system, keyboards seem to generally be number 3), or 'on' and 'off' (on will turn ALL lights on, and off will turn ALL lights off).

To turn on the lights:

$ xset led NUMBER

To turn off the lights:

$ xset -led NUMBER

D-Bus

You can control your computer keyboard backlight via the D-Bus interface. The benefits of using it are that no modification to device files is required and it is vendor agnostic.

The following is an example implementation in Python 3. Install upower and packages then place the following script in and make it executable. You can then map your keyboard shortcuts to run and to increase and decrease your keyboard backlight level by x amounts.

Alternatively the following bash one-liner will set the backlight to the value specified in the argument:

On GNOME

The following can be run from a terminal or mapped to keybindings

$ gdbus call --session --dest org.gnome.SettingsDaemon.Power --object-path /org/gnome/SettingsDaemon/Power --method org.gnome.SettingsDaemon.Power.Keyboard.StepUp
$ gdbus call --session --dest org.gnome.SettingsDaemon.Power --object-path /org/gnome/SettingsDaemon/Power --method org.gnome.SettingsDaemon.Power.Keyboard.StepDown

On MATE

In case you use MATE environment you might get tired with repeated lighting keyboard backlight while logging in, unlocking screen or waking up dimmed display. Following setup prevent from automatic lighting up during any action. The only triggers remain plugging in the adapter and fresh boot. After that you can control keyboard backlight only via hotkeys (eg. ThinkPad Fn + spacebar).

To prevent automatic lighting up just edit file as follows (two occurrences of "deny"):

gollark: That's obviously not true except possibly in multicore.
gollark: How would *that* happen?
gollark: They biased it heavily toward singlecore when AMD started releasing high core count things cheaply.
gollark: They have not, in fact, made something 50 times more powerful than all competitors.
gollark: "Metal score" sounds like they're using Metal, i.e. the *GPU* abstraction layer on macOS.
This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.