Posts Tagged ‘UNIX-like’

Map Caps Lock to Control in X Windows

22 Oct 2008

Motivation

I use the control key a lot. Between my Fluxbox keys file shortcuts, several Xterms with bash, and Emacs, the pinky on my left hand is getting worn out quickly. It may not seem productive at first, but every engineer should spend some time setting up the simple things in his or her lab, including getting a comfortable keyboard.

Using

  • a standard US keyboard
  • a UNIX-like system running an X windows server (if you are on a UNIX-like system and have a graphical display, you are probably running X windows)
  • xmodmap

Setup

Here is my $HOME/.Xmodmap file:

! map Caps Lock key to Control
remove Lock = Caps_Lock
keysym Caps_Lock = Control_L
add Control = Control_L

! map right Windows/Super key to Caps Lock
remove Mod4 = Super_R
keysym Super_R = Caps_Lock
add Lock = Caps_Lock

To activate it, wait until you restart X or run from the command line:

$ xmodmap $HOME/.Xmodmap

Done. Now I just need to break the Control_L habit. Fortunately, I kept that key mapped as Control_L so it still works as expected. This feels like the old days in the UNIX workstation lab, except that my keyboard is much, much cleaner.

Advertisements