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.
51
52       -pk     This option indicates that the current keymap table  should  be
53               printed on the standard output.
54
55       -pke    This  option  indicates that the current keymap table should be
56               printed on the standard output in the form of expressions  that
57               can be fed back to xmodmap.
58
59       -pp     This  option  indicates  that the current pointer map should be
60               printed on the standard output.
61
62       -       A lone dash means that the standard input should be used as the
63               input file.
64
65       The filename specifies a file containing xmodmap expressions to be exe‐
66       cuted.  This file is usually kept in the user's home directory  with  a
67       name like .xmodmaprc.
68

EXPRESSION GRAMMAR

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

EXAMPLES

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

ENVIRONMENT

218       DISPLAY to get default host and display number.
219

SEE ALSO

221       X(7), xev(1), Xlib documentation on key and pointer events
222

BUGS

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

AUTHOR

237       Jim  Fulton,  MIT  X  Consortium,  rewritten from an earlier version by
238       David Rosenthal of Sun Microsystems.
239
240
241
242
243X Version 11                     xmodmap 1.0.1                      XMODMAP(1)
Impressum