Ubuntu – Map caps-lock key to middle mouse click


Since I rarely use caps-lock, I'd like to map the key to a middle mouse click instead. I would also like to map Alt+Caps Lock to the original function of the caps lock key, should I ever need it.

I can map any keyboard shortcut to xdotool click 2, but the Gnome Keyboard Shortcuts dialog won't let me assign a command to the caps-lock key, even with modifiers.

I know this is a bit of a strange undertaking; How would I go about doing it?

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:

    echo  'remove lock = Caps_Lock' | xmodmap -