To turn the keyboard's backlight on & off open a terminal and type the following:
xset led onto turn on the backlight and
xset led offto turn off the backlight.
Although the lights are now on you need to type the above commands each time you want to turn on/off the backlight which is not convenient. Hence I decided to write a small BASH script and point it to the Scroll Lock button. Start by creating an empty file using Gedit or any other text editing program. Now copy & paste the following:
#!/bin/bash FLAGS=$(xset -q | awk 'NR==2' | awk '{ print $10 }') if [ "$FLAGS" = ffffe7fe ]; then xset led off else xset led on fiNow save the file with the .sh extension. (I named it keyboard-led.sh) Move it in your root directory (or wherever you like) and make the script executable by typing (using a terminal):
chmod u+x keyboard-led.shTest the script by running:
./keyboard-led.shNow to make things simpler why don't we assign the script to a button in the keyboard? Open the keyboard settings and go to Custom Shortcuts. Then create a new shortcut. Give it a name and in the command section type /keyboard-led.sh. Finally click on the right of the shortcut and click the Scroll Lock button. Test if it works by pressing the Scroll Lock button.
Update 1: I noticed that in order to turn off the backlight I need to disable Num Lock or Caps Lock or both if they are enabled first (weird).
Update 2: The above problem is now fixed. Another problem remain though. When the backlight is on I can't use the Num Pad.
Now to the problem. What I did is I replaced the code in keyboard-led.sh with the code above:
#!/bin/bash FLAGS=$(xset -q | awk 'NR==2' | awk '{ print $10 }') printf "$FLAGS""\n" xset led on FLAGS=$(xset -q | awk 'NR==2' | awk '{ print $10 }') printf "$FLAGS""\n"and then I opened the terminal and I run /keyboard-led.sh 4 times.
The first time Num Lock and Caps Lock were disabled.
The output was ffffe7fc
The second time only Num Lock was enabled.
The output was ffffe7fd
The third time only Caps Lock was enabled.
The output was ffffe7fe
The fourth time both Nums Lock and Caps lock were enabled.
The output was ffffe7fe
Based on the outputs I created a condition that turns the backlight on & off even if Caps Lock or Num Lock or both are enabled. Replace the existing code in keyboard-led.sh with the code below.
#!/bin/bash FLAGS=$(xset -q | awk 'NR==2' | awk '{ print $10 }') if [ "$FLAGS" = ffffe7fc ] || [ "$FLAGS" = ffffe7fd ] || [ "$FLAGS" = ffffe7fe ] || [ "$FLAGS" = ffffe7ff ]; then xset led off else xset led on fiUpdate 3: Problem fixed. I noticed that when the backlight is on the Num Pad acts as a pointer controller (i.e. You can control the mouse pointer using the Num Pad). You can disable it through Universal Access -> Pointing and Clicking -> Control the pointer using the keypad.