8

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
  • UEFI or MBR booting? If the former, you may not be loading the samsung-laptop module which controls this functionality.
    – jasonwryan
    Aug 30, 2014 at 23:17
  • I think it is MBR, because in the bios I need to put uefi/efi mixed setup instead of just uefi that is default. But just to be sure, there is any command that can I run to return the booting system mode? Sep 1, 2014 at 3:04
  • 3
    UEFI booted systems will have /sys/firmware/efi present.
    – jasonwryan
    Sep 1, 2014 at 3:20

3 Answers 3

7

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
1

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 &
1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .