install the pre-requisites:
sudo apt-get install xbindkeys xautomation
Then create the xbindkeys config file:
touch .xbindkeysrc
bind the key:
Now we need to figure out what the keysym of your caps lock button is. Run
xev | grep key
Put your mouse into the box that appears and press the caps lock button. This is what I get.
The important part here is
(keysym 0xffe5, Caps_Lock),
Write the keysym (0xffe5
) down, you'll need it later.
Now edit the xbindkeys config file.
gedit .xbindkeysrc
And add the following to the file:
" xte 'key 0xffe5' "
b:2
(note, replace 0xffe5
with whatever number you got earlier. I bet it will be the same, but I'm not sure).
Save and close the file. Now run:
xbindkeys
You're done!
Caveat:
On my keyboard, this method didn't toggle the light on the caps lock key, (which is understandable), so you will probably lose any indicators you have that caps is enabled. Any software indicators should still work though.
Best Answer
If you first remove the lock modifier from the Caps Lock key you should then be able to assign the key in Keyboard Shortcuts, use the command below to do that: