1XMODMAP(1)                  General Commands Manual                 XMODMAP(1)
2
3
4

NAME

6       xmodmap  - utility for modifying keymaps and pointer button mappings in
7       X
8

SYNOPSIS

10       xmodmap [-options ...] [filename]
11

DESCRIPTION

13       The xmodmap program is used to edit and display the  keyboard  modifier
14       map  and  keymap  table that are used by client applications to convert
15       event keycodes into keysyms.  It is usually run from the user's session
16       startup script to configure the keyboard according to personal tastes.
17

OPTIONS

19       The following options may be used with xmodmap:
20
21       -display display
22               This option specifies the host and display to use.
23
24       -help   This  option  indicates that a brief description of the command
25               line arguments should be printed on the standard error channel.
26               This  will  be  done whenever an unhandled argument is given to
27               xmodmap.
28
29       -grammar
30               This option indicates that a help message  describing  the  ex‐
31               pression  grammar  used in files and with -e expressions should
32               be printed on the standard error.
33
34       -version
35               This option indicates that xmodmap should print its version in‐
36               formation and exit.
37
38       -verbose
39               This  option indicates that xmodmap should print logging infor‐
40               mation as it parses its input.
41
42       -quiet  This option turns off the verbose logging.   This  is  the  de‐
43               fault.
44
45       -n      This  option  indicates that xmodmap should not change the map‐
46               pings, but should display what it would do, like  make(1)  does
47               when given this option.
48
49       -e expression
50               This option specifies an expression to be executed.  Any number
51               of expressions may be specified from the command line.
52
53       -pm     This option indicates that the current modifier map  should  be
54               printed  on  the standard output.   This is the default mode of
55               operation if no other mode options are specified.
56
57       -pk     This option indicates that the current keymap table  should  be
58               printed on the standard output.
59
60       -pke    This  option  indicates that the current keymap table should be
61               printed on the standard output in the form of expressions  that
62               can be fed back to xmodmap.
63
64       -pp     This  option  indicates  that the current pointer map should be
65               printed on the standard output.
66
67       -       A lone dash means that the standard input should be used as the
68               input file.
69
70       The filename specifies a file containing xmodmap expressions to be exe‐
71       cuted.  This file is usually kept in the user's home directory  with  a
72       name like .xmodmaprc.
73

EXPRESSION GRAMMAR

75       The xmodmap program reads a list of expressions and parses them all be‐
76       fore attempting to execute any of them.  This makes it possible to  re‐
77       fer to keysyms that are being redefined in a natural way without having
78       to worry as much about name conflicts.
79
80       The  list  of  keysym  names  may  be  found   in   the   header   file
81       <X11/keysymdef.h>  (without  the XK_ prefix).  Keysyms matching Unicode
82       characters may be specified  as  "U0020"  to  "U007E"  and  "U00A0"  to
83       "U10FFFF" for all possible Unicode characters.
84
85       keycode NUMBER = KEYSYMNAME ...
86               The list of keysyms is assigned to the indicated keycode (which
87               may be specified in decimal, hex or octal and can be determined
88               by  running  the  xev program).  Up to eight keysyms may be at‐
89               tached to a key, however the last four are not used in any  ma‐
90               jor  X server implementation.  The first keysym is used when no
91               modifier key is pressed in conjunction with this key, the  sec‐
92               ond with Shift, the third when the Mode_switch key is used with
93               this key and the fourth when both  the  Mode_switch  and  Shift
94               keys are used.
95
96       keycode any = KEYSYMNAME ...
97               If  no  existing key has the specified list of keysyms assigned
98               to it, a spare key on the keyboard is selected and the  keysyms
99               are  assigned  to  it.  The list of keysyms may be specified in
100               decimal, hex or octal.
101
102       keysym KEYSYMNAME = KEYSYMNAME ...
103               The KEYSYMNAME on the left hand side is translated into  match‐
104               ing  keycodes  used to perform the corresponding set of keycode
105               expressions.  Note that if the same keysym is bound to multiple
106               keys, the expression is executed for each matching keycode.
107
108       clear MODIFIERNAME
109               This removes all entries in the modifier map for the given mod‐
110               ifier, where valid name are: Shift, Lock, Control, Mod1,  Mod2,
111               Mod3,  Mod4,  and Mod5 (case does not matter in modifier names,
112               although it does matter for all  other  names).   For  example,
113               ``clear  Lock'' will remove all any keys that were bound to the
114               shift lock modifier.
115
116       add MODIFIERNAME = KEYSYMNAME ...
117               This adds all keys containing the given keysyms  to  the  indi‐
118               cated  modifier  map.  The keysym names are evaluated after all
119               input expressions are read to make it easy to write expressions
120               to swap keys (see the EXAMPLES section).
121
122       remove MODIFIERNAME = KEYSYMNAME ...
123               This removes all keys containing the given keysyms from the in‐
124               dicated modifier map.  Unlike add, the keysym names are  evalu‐
125               ated  as  the  line is read in.  This allows you to remove keys
126               from a modifier without having to worry about  whether  or  not
127               they have been reassigned.
128
129       pointer = default
130               This  sets the pointer map back to its default settings (button
131               1 generates a code of 1, button 2 generates a 2, etc.).
132
133       pointer = NUMBER ...
134               This sets the pointer  map  to  contain  the  indicated  button
135               codes.   The list always starts with the first physical button.
136               Setting a button code to 0 disables events from that button.
137
138       Lines that begin with an exclamation point (!) are taken as comments.
139
140       If you want to change the binding of a modifier key, you must also  re‐
141       move it from the appropriate modifier map.
142

EXAMPLES

144       Many  pointers are designed such that the first button is pressed using
145       the index finger of the right hand.  People who  are  left-handed  fre‐
146       quently  find  that  it is more comfortable to reverse the button codes
147       that get generated so that the primary button is pressed using the  in‐
148       dex  finger of the left hand.  This could be done on a 3 button pointer
149       as follows:
150       %  xmodmap -e "pointer = 3 2 1"
151
152       Many applications support the notion of Meta keys (similar  to  Control
153       keys  except that Meta is held down instead of Control).  However, some
154       servers do not have a Meta keysym in the default keymap table,  so  one
155       needs  to  be added by hand.  The following command will attach Meta to
156       the Multi-language key (sometimes labeled Compose Character).  It  also
157       takes advantage of the fact that applications that need a Meta key sim‐
158       ply need to get the keycode and don't require the keysym to be  in  the
159       first  column  of  the keymap table.  This means that applications that
160       are looking for a Multi_key (including the default modifier map)  won't
161       notice any change.
162       %  xmodmap -e "keysym Multi_key = Multi_key Meta_L"
163
164       Similarly,  some  keyboards  have  an Alt key but no Meta key.  In that
165       case the following may be useful:
166       %  xmodmap -e "keysym Alt_L = Meta_L Alt_L"
167
168       One of the more simple, yet convenient, uses of xmodmap is to  set  the
169       keyboard's  "rubout"  key  to  generate an alternate keysym.  This fre‐
170       quently involves exchanging Backspace with Delete to be  more  comfort‐
171       able  to  the  user.  If the ttyModes resource in xterm is set as well,
172       all terminal emulator windows will use the same key for erasing charac‐
173       ters:
174       %  xmodmap -e "keysym BackSpace = Delete"
175       %  echo "XTerm*ttyModes:  erase ^?" | xrdb -merge
176
177       Some keyboards do not automatically generate less than and greater than
178       characters when the comma and period keys are  shifted.   This  can  be
179       remedied  with  xmodmap by resetting the bindings for the comma and pe‐
180       riod with the following scripts:
181       !
182       ! make shift-, be < and shift-. be >
183       !
184       keysym comma = comma less
185       keysym period = period greater
186
187       One of the more irritating differences between keyboards is  the  loca‐
188       tion  of  the Control and CapsLock keys.  A common use of xmodmap is to
189       swap these two keys as follows:
190       !
191       ! Swap Caps_Lock and Control_L
192       !
193       remove Lock = Caps_Lock
194       remove Control = Control_L
195       keysym Control_L = Caps_Lock
196       keysym Caps_Lock = Control_L
197       add Lock = Caps_Lock
198       add Control = Control_L
199
200       This example can be run again to swap the keys back to  their  previous
201       assignments.
202
203       The keycode command is useful for assigning the same keysym to multiple
204       keycodes.  Although unportable, it also  makes  it  possible  to  write
205       scripts  that  can  reset the keyboard to a known state.  The following
206       script sets the backspace key to  generate  Delete  (as  shown  above),
207       flushes  all  existing  caps lock bindings, makes the CapsLock key be a
208       control key, make F5 generate Escape, and makes Break/Reset be a  shift
209       lock.
210       !
211       ! On the HP, the following keycodes have key caps as listed:
212       !
213       !     101  Backspace
214       !      55  Caps
215       !      14  Ctrl
216       !      15  Break/Reset
217       !      86  Stop
218       !      89  F5
219       !
220       keycode 101 = Delete
221       keycode 55 = Control_R
222       clear Lock
223       add Control = Control_R
224       keycode 89 = Escape
225       keycode 15 = Caps_Lock
226       add Lock = Caps_Lock
227

ENVIRONMENT

229       DISPLAY to get default host and display number.
230

SEE ALSO

232       X(7),  xev(1),  setxkbmap(1), XStringToKeysym(3), Xlib documentation on
233       key and pointer events
234

BUGS

236       Every time a keycode expression is evaluated, the  server  generates  a
237       MappingNotify  event  on  every client.  This can cause some thrashing.
238       All of the changes  should  be  batched  together  and  done  at  once.
239       Clients  that  receive  keyboard  input and ignore MappingNotify events
240       will not notice any changes made to keyboard mappings.
241
242       Xmodmap should generate "add" and  "remove"  expressions  automatically
243       whenever a keycode that is already bound to a modifier is changed.
244
245       There  should be a way to have the remove expression accept keycodes as
246       well as keysyms for those times when you really mess up your mappings.
247

AUTHOR

249       Jim Fulton, MIT X Consortium, rewritten  from  an  earlier  version  by
250       David Rosenthal of Sun Microsystems.
251
252
253
254
255X Version 11                    xmodmap 1.0.10                      XMODMAP(1)
Impressum