TransWikia.com

How to control keyboard backlight using hotkeys

Unix & Linux Asked by lcsvcn on December 3, 2021

How can I turn increase and decrease the keyboard backlight in notebook on Linux using the same hotkeys used on Windows?

In Windows I can control the keyboard backlight by pressing hotkeys (FnF9 to decrease and FnF10 to increase), but in Linux it doesn’t seems to have these hotkeys implemented as the keyboard backlight is a new and not most spread feature for the notebooks/ultrabooks.

Note: The Fn is working for normal features like display brightness and sound, just for controlling the keyboard backlight it is not configured correctly… But it works in the Linux, as I can turn it on in the Grub2 boot device selector, but not in the running Linux OS.

Just some extra-specs: OS : Linux (Mint Cinnamon 17). Notebook: Samsung Ativ Book 6.

3 Answers

Following https://wiki.archlinux.org/index.php/keyboard_backlight I ended up using D-Bus to avoid requiring root privileges:

$ dbus-send --system --type=method_call --print-reply=literal 
  --dest="org.freedesktop.UPower" "/org/freedesktop/UPower/KbdBacklight" 
  "org.freedesktop.UPower.KbdBacklight.GetMaxBrightness"

   int32 2

$ dbus-send --system --type=method_call 
  --dest="org.freedesktop.UPower" "/org/freedesktop/UPower/KbdBacklight" 
  "org.freedesktop.UPower.KbdBacklight.SetBrightness" int32:1

I imagine that to incrementally adjust the brightness you could write some small shell script or other tool that does a GetBrightness call followed by SetBrightness with a change applied to the previous value. Haven't tried that since I don't have any dedicated brightness adjustment buttons on my keyboard and don't want to clobber any existing key bindings. At least for now.

Answered by MvG on December 3, 2021

You can use yad to control backlight brightness; I used the following slider for chromebook Acer cb714 running fatdog linux

yad --no-buttons --on-top --vertical --scale --print-partial --value=$(cat /sys/class/leds/*::kbd_backlight/brightness) | while read line; do echo "$line" > /sys/class/leds/*::kbd_backlight/brightness; sleep 0.01; done &

Answered by Em See on December 3, 2021

The keys usually used to control keyboard backlight are XF86KbdBrightnessUp and XF86KbdBrightnessDown. You just need to find a way to bind it to the following shell command lines (and set the sudoers as needed):

# Light off the leds
sudo echo 0 > /sys/class/leds/asus::kbd_backlight/brightness
# Light on the leds (full power)
sudo echo 100 > /sys/class/leds/asus::kbd_backlight/brightness

Answered by perror on December 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP