Light up key board

broken image

The following is an example implementation in Python 3. The benefits of using it are that no modification to device files is required and it is vendor agnostic. You can control your computer keyboard backlight via the D-Bus interface. $ brightnessctl -device='tpacpi::kbd_backlight' set 1 This will show the absolute and relative current value and the maximum absolute value. $ brightnessctl -device='tpacpi::kbd_backlight' info When using brightnessctl you can get a list of available brightness controls with brightnessctl -list, then to show the kbd backlight information: # echo 1 > /sys/class/leds/tpacpi::kbd_backlight/brightness $ cat /sys/class/leds/tpacpi::kbd_backlight/max_brightness For example to get the maximum brightness level:

broken image

The current brightness level can be get by reading /sys/class/leds/tpacpi::kbd_backlight/brightness. The sys pseudo-file system exposes an interface to the keyboard backlight. There are a variety ways to manage the brightness level and different helpers tools to accomplish this, such as brightnessctl or light.