HMC Homepage      CS Home

How to Use xmodmap

xmodmap is a utility for modifying keymaps in X windows. It is a powerful and confusing tool. Its options are too many to go over here, so we'll just document what xmodmap is most commonly used for: assigning the Meta key.

Since many of our newer keyboards don't have a Meta key, it isn't bound by default. This is a problem because the Meta key is used in many common programs. Alt, on the other hand, is used in hardly any programs on turing. Some programs say they want "Alt" but they really mean Meta. For this reason, many people bind the Alt key to Meta and the Windows key to Alt. Issuing the following commands to xmodmap will bind that behavior:

clear mod1
clear mod4
keycode 33 = Meta_L
keycode 147 = Alt_L
add mod1 = Meta_L
add mod4 = Alt_L

33 is the keycode for the key labeled "Alt" and 147 is the keycode for the Windows key. Some people prefer them to be bound the other way around, so simply switching the numbers around will bind that behavior.

There are several ways to give xmodmap commands, the recommended way is to place the commands in a text file in your home directory and add the line

xmodmap filename

to the .login file in your home directory. This will ensure that whenever you login the keys will be bound to your preferences.


HMC Computer Science Department
Contact Information
Last Modified Thursday, 01-Jul-2004 13:51:48 PDT