Reputation: 13526
When keyboard has no LED, for Linux machine, is there an easy way to do this? By Command Line, Python, Perl or Ruby, to show when keyboard has CapLock
, NumLock
activated?
Upvotes: 6
Views: 8483
Reputation: 1594
If you have multiple language input-sources installed, you'll likely have a language switching menu in the top-right corner (i.e. [ en | fr ]). Its context menu has an option "Show Keyboard Layout" which has its own virtual LED indicator.
However, it only stays in sync if that window has the focus. If you e.g. toggle numlock in gedit but keep this window open in the background, you'll see that it keeps its old state.
Upvotes: 0
Reputation: 91
If you want to use the command line to check led status use:
xset q | grep LED
This will return a number resulting from the binary addition of the led status lights. Caps lock is the first bit, Numlock is the second... the rest you need to experiment as I have only used those two.
Upvotes: 9
Reputation: 2929
This is a good question, also applies if you have a virtual machine.
I found the following code worked well on my Ubuntu lucid VM running on ESXi 5.1 with no hardware LEDs on a mx5500 revolution Bluetooth keyboard combo.
http://freecode.com/projects/numlockx
tar -xzf numlockx-1.2.tar.gz
./configure
make
./numlockx on
You may not be able to see the current state, but at least you can force it to be what you want.
Upvotes: 1
Reputation: 7434
Check this post about the key-mon tool.
http://www.webupd8.org/2009/12/key-mon-displays-keyboard-and-mouse.html
As far as I know there is also a CLI command to check the status in the package.
Upvotes: 1