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
31               expression grammar used in files and with -e expressions should
32               be printed on the standard error.
33
34       -verbose
35               This option indicates that xmodmap should print logging  infor‐
36               mation as it parses its input.
37
38       -quiet  This  option  turns  off  the  verbose  logging.   This  is the
39               default.
40
41       -n      This option indicates that xmodmap should not change  the  map‐
42               pings,  but  should display what it would do, like make(1) does
43               when given this option.
44
45       -e expression
46               This option specifies an expression to be executed.  Any number
47               of expressions may be specified from the command line.
48
49       -pm     This  option  indicates that the current modifier map should be
50               printed on the standard output.   This is the default  mode  of
51               operation if no other mode options are specified.
52
53       -pk     This  option  indicates that the current keymap table should be
54               printed on the standard output.
55
56       -pke    This option indicates that the current keymap table  should  be
57               printed  on the standard output in the form of expressions that
58               can be fed back to xmodmap.
59
60       -pp     This option indicates that the current pointer  map  should  be
61               printed on the standard output.
62
63       -       A lone dash means that the standard input should be used as the
64               input file.
65
66       The filename specifies a file containing xmodmap expressions to be exe‐
67       cuted.   This  file is usually kept in the user's home directory with a
68       name like .xmodmaprc.
69

EXPRESSION GRAMMAR

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

EXAMPLES

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

ENVIRONMENT

226       DISPLAY to get default host and display number.
227

SEE ALSO

229       X(7),  xev(1),  setxkbmap(1), XStringToKeysym(3), Xlib documentation on
230       key and pointer events
231

BUGS

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

AUTHOR

246       Jim Fulton, MIT X Consortium, rewritten  from  an  earlier  version  by
247       David Rosenthal of Sun Microsystems.
248
249
250
251
252X Version 11                     xmodmap 1.0.5                      XMODMAP(1)
Impressum