Ubuntu – How to remap the caps lock key

keyboardshortcut-keysxorg

In the the past I used to use xmodmap to prevent the Caps Lock button from working, and then tell Launchy to handle the key press instead. I can't seem to do this anymore.

What is the best way to disable Caps Lock's normal behavior, and make it do something else?

Best Answer

From howtogeek.com which has a good answer for any OS.

For Linux (including Ubuntu):

setxkbmap -option <OPTION>

Where <OPTION> can be for example of:

  • caps:none – Disables Caps Lock.
  • caps:super – Caps Lock becomes an additional Super (aka Win key).
  • caps:ctrl_modifier – Caps Lock becomes an additional Ctrl.
  • caps:numlock – Caps Lock becomes an additional Num Lock.
  • caps:escape – Caps Lock becomes an additional Escape.
  • caps:backspace – Caps Lock becomes an additional Backspace.
  • caps:swapescape – Caps Lock becomes Escape, and Escape becomes Caps Lock

Note: Xmodmap is deprecated in favor of setxkbmap.

Related Question