Changing caps lock to control with .Xmodmap

There are a lot of instructions around the internet for various ways to swap the caps lock and control keys. I usually want to just get rid of caps lock all together. There are a few ways but one of the easiest is to use a ~/.Xmodmap file. To use this create .Xmodmap in your home directory and reboot or restart X windows. This example .Xmodmap gets rid of caps lock and makes both the caps lock key and control keys use the control functionality. As the comment says uncomment the rest of the lines to swap caps lock and control instead of just getting rid of control.

!
! Make caps lock control. Uncomment the commented out lines below to swap
! caps lock and control.
!
remove Lock = Caps_Lock
!remove Control = Control_L
!keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
!add Lock = Caps_Lock
add Control = Control_L

[Update: 2011-12-29 I still use my HHK at work but switched back to a regular style keyboard at home.]

4 Comments

  1. Pedro says:

    What’s the purpose of remapping CapsLock to Control? I have to hit it with the pinky anyway, so it’s not super convenient.

  2. Eric Bergen says:

    My wrist started to hurt after hitting the original control key for a few years. I never use caps lock so remapping caps lock to control where I can use control with less wrist movement makes sense. The caps lock key was taking up prime keyboard real estate and serving no purpose other than me accidentally turning on caps lock when I didn’t want it.

  3. jmeter says:

    I started using a new ergonomic keyboard that has changed my life, no remapping needed.

  4. Ben says:

    Yes Eric, just switch to dvorak finally *:)

Leave a Reply