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.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
lcsvcn
  • 181
  • 1
  • 1
  • 2
  • UEFI or MBR booting? If the former, you may not be loading the `samsung-laptop` module which controls this functionality. – jasonwryan Aug 30 '14 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? – lcsvcn Sep 01 '14 at 03:04
  • 3
    UEFI booted systems will have `/sys/firmware/efi` present. – jasonwryan Sep 01 '14 at 03:20

3 Answers3

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
perror
  • 3,171
  • 7
  • 33
  • 45
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 &
Em See
  • 11
  • 2
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.

MvG
  • 4,361
  • 2
  • 28
  • 42