Ubuntu – Wayland equivalent to “xset led”

backlightcommand linewayland

I have been using Ubuntu since 16.04, with the CM Storm keyboard. When using this keyboard on Windows, pressing the Scroll Lock key enables/disables the backlight.

Previously on Ubuntu, the commands xset led (on) and xset -led (off) have worked to set the backlight. This is pretty important because the key labels are very hard to read without the backlight enabled.

Now that Ubuntu has switched from X to Wayland by default with 17.10, xset no longer works. While I can make it work by selecting an Xorg session on login, I'd like to use the default and what will be the future of Ubuntu, Wayland.

What I'm looking for are some terminal commands that accomplish the same function as xset led and xset -led.

Best Answer

I also struggled with this and finally came up with a solution:

https://gist.github.com/ps1dr3x/b15c62eafb388ddf8bb7d3896d1a1cee

Basically you can turn on/off the keyboard backlight by changing the brightness value in /sys/class/leds/input/brightness

e.g.

sudo sh -c 'echo 1 > /sys/class/leds/input0::scrolllock/brightness'

P.s. input might be different