Ever since I first dual-booted Ubuntu 16.04 on my Surface Pro 3, my caps lock indicator LED on my keyboard hasn't worked. I decided to try and do something about it recently. When I type the command
echo 1 | sudo tee /sys/class/leds/input45\:\:capslock/brightness
The light comes on, so it is at least accessible. I'm not sure what to do to make the light go on or off depending on the state of caps lock though. Any help would be greatly appreciated.
Best Answer
Apparently, somehow the led is not set automatically. The background- patch below will take care of that:
How to use:
fix_led
(no extension) in/usr/local/bin
and make it executable./sys/class/leds/input45::capslock/brightness
you need to add the script to the sudoers file, as explained e.g. here.Test- run the script by running
in a terminal, test your Caps Lock key.
Now add the script to your startup applications: Dash > Startup Applications > Add. Add the command:
That's it. On next restart (log in), it should work.
Notes
Of course, the patch should work in all situations where the led is not functioning. the exact location of the file
capslock/brightness
may vary however. Set, if necessary, the location in the line:in the head of the script (don't escape the
:
inpython
). I tested the script by making it set the led the wrong way :) (led off when Caps Lock was on, on when it was off).Explanation
Information on the current Caps Lock state can be fetched by the command:
Once per second, the script checks if
Caps Lock: on
is in the output. The script also checks if the current state matches the led state (either 1 or 0), as read from thecapslock/brightness
file.If these two do not match, the script sets the led state according to the real Caps Lock state.