Skip to content

Backlight and Keyboard Brightness Integration

Louis DeLosSantos edited this page Jun 25, 2024 · 2 revisions

Backlight and Keyboard Brightness Integration

Linux makes adjusting brightness parameters on a laptop's screen and keyboard available via a virtual directly.

These directories can always be located within /sys/class/[backlight|leds]

However, you typically need to be root to adjust these.

Way-Shell interfaces with Systemd's Logind service which can act as a root proxy for adjusting the brightness files found in these virtual directories.

Laptop Screen Brightness

Your laptop's screen brightness file is usually discoverable inside the directory /sys/class/backlight/{vendor_specific} where {vendor_specific} may change depending on your laptop.

For instance, on my Lenovo X1 Carbon the vendor specific directory is intel_backlight.

Here is a directory listing to get your bearings.

ls /sys/class/backlight/intel_backlight
 actual_brightness   bl_power   brightness   device   max_brightness   power   scale   subsystem   type   uevent

Way-Shell always assumes that backlight files can be found at the prefix /sys/class/backlight. Therefore, a dconf configuration exists which simply asks for the vendor specific directory and providing this will enable brightness integration.

The dconf key can be found at /org/ldelossa/way-shell/system/backlight-directory and the value is the vendor specific directory as a string.

dconf read /org/ldelossa/way-shell/system/backlight-directory
'intel_backlight'

Keyboard backlight

Most of what is said above is mirrored for keyboard backlights, however the directory changes a bit.

You can find your keyboard backlight brightness files in /sys/class/leds/{vendor_specific}

Here is a directory listing to get your bearings.

ls /sys/class/leds/tpacpi::kbd_backlight 
 brightness   brightness_hw_changed   device   max_brightness   power   subsystem   trigger   uevent

Likewise, a dconf key exists for providing the vendor specific keyboard backlight directory to Way-Shell.

dconf read /org/ldelossa/way-shell/system/keyboard-backlight-directory 
'tpacpi::kbd_backlight'