I have the same question as Map caps-lock key to middle mouse click, but I had two problems using it. First, removing the normal use of caps lock didn't work. Second, I can't use it to hold the middle mouse button. Also, easystrokes doesn't seem to exist anymore, so that answer isn't helpful.
install the pre-requisites:
sudo apt-get install xbindkeys xautomation
Then create the xbindkeys config file:
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.
And add the following to the file:
" xte 'key 0xffe5' " b:2
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:
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.