1
.\" $Xorg: xmodmap.man,v 1.4 2001/02/09 02:05:56 xorgcvs Exp $
2
.\" Copyright 1988, 1989, 1990, 1998 The Open Group
3
.\" Copyright 1987 Sun Microsystems, Inc.
5
.\" Permission to use, copy, modify, distribute, and sell this software and its
6
.\" documentation for any purpose is hereby granted without fee, provided that
7
.\" the above copyright notice appear in all copies and that both that
8
.\" copyright notice and this permission notice appear in supporting
11
.\" The above copyright notice and this permission notice shall be included
12
.\" in all copies or substantial portions of the Software.
14
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18
.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19
.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20
.\" OTHER DEALINGS IN THE SOFTWARE.
22
.\" Except as contained in this notice, the name of The Open Group shall
23
.\" not be used in advertising or otherwise to promote the sale, use or
24
.\" other dealings in this Software without prior written authorization
25
.\" from The Open Group.
27
.\" $XFree86: xc/programs/xmodmap/xmodmap.man,v 1.11 2002/10/12 16:06:48 herrb Exp $
29
.de EX \"Begin example
42
.TH XMODMAP 1 __xorgversion__
44
xmodmap - utility for modifying keymaps and pointer button mappings in X
47
[-options ...] [filename]
50
The \fIxmodmap\fP program is used to edit and display the
51
keyboard \fImodifier map\fP and \fIkeymap table\fP that are used by client
52
applications to convert event keycodes into keysyms. It is usually run from
53
the user's session startup script to configure the keyboard according to
57
The following options may be used with \fIxmodmap\fP:
59
.B \-display \fIdisplay\fP
60
This option specifies the host and display to use.
63
This option indicates that a brief description of the command line arguments
64
should be printed on the standard error channel. This will be done whenever an
65
unhandled argument is given to
69
This option indicates that a help message describing the expression grammar
70
used in files and with \-e expressions should be printed on the standard error.
73
This option indicates that
75
should print logging information as it parses its input.
78
This option turns off the verbose logging. This is the default.
81
This option indicates that
83
should not change the mappings, but should display what it would do, like
84
\fImake(1)\fP does when given this option.
86
.B \-e \fIexpression\fB
87
This option specifies an expression to be executed. Any number of expressions
88
may be specified from the command line.
91
This option indicates that the current modifier map should be printed on the
92
standard output. This is the default mode of operation if no other mode
93
options are specified.
96
This option indicates that the current keymap table should be printed on the
100
This option indicates that the current keymap table should be printed on the
101
standard output in the form of expressions that can be fed back to
105
This option indicates that the current pointer map should be printed on the
109
A lone dash means that the standard input should be used as the input file.
111
The \fIfilename\fP specifies a file containing \fIxmodmap\fP expressions
112
to be executed. This file is usually kept in the user's home directory with
113
a name like \fI.xmodmaprc\fP.
114
.SH EXPRESSION GRAMMAR
118
program reads a list of expressions and parses them all before attempting
119
to execute any of them. This makes it possible to refer to keysyms that are
120
being redefined in a natural way without having to worry as much about name
123
.B keycode \fINUMBER\fP = \fIKEYSYMNAME ...\fP
124
The list of keysyms is assigned to the indicated keycode
125
(which may be specified in decimal, hex or octal and can be determined by
128
program). Up to eight keysyms may be attached to a key, however the last four
129
are not used in any major X server implementation. The first keysym is used
130
when no modifier key is pressed in conjunction with this key, the second with
131
Shift, the third when the Mode_switch key is used with this key and the fourth
132
when both the Mode_switch and Shift keys are used.
134
.B keycode any = \fIKEYSYMNAME ...\fP
135
If no existing key has the specified list of keysyms assigned to it,
136
a spare key on the keyboard is selected and the keysyms are assigned to it.
137
The list of keysyms may be specified in decimal, hex or octal.
139
.B keysym \fIKEYSYMNAME\fP = \fIKEYSYMNAME ...\fP
140
The \fIKEYSYMNAME\fP on the left hand side is translated into matching keycodes
141
used to perform the corresponding set of \fBkeycode\fP expressions.
142
The list of keysym names may be
143
found in the header file \fI<X11/keysymdef.h>\fP (without the \fIXK_\fP prefix)
144
or the keysym database \fI __projectroot__/lib/X11/XKeysymDB\fP. Note that
145
if the same keysym is bound to multiple keys, the expression is executed
146
for each matching keycode.
148
.B clear \fIMODIFIERNAME\fP
149
This removes all entries in the modifier map for the given modifier, where
159
does not matter in modifier names, although it does matter for all other
160
names). For example, ``clear Lock'' will remove
161
all any keys that were bound to the shift lock modifier.
163
.B add \fIMODIFIERNAME\fP = \fIKEYSYMNAME ...\fP
164
This adds all keys containing the given keysyms to the indicated modifier map.
166
are evaluated after all input expressions are read to make it easy to write
167
expressions to swap keys (see the EXAMPLES section).
169
.B remove \fIMODIFIERNAME\fP = \fIKEYSYMNAME ...\fP
170
This removes all keys containing the given keysyms from the indicated
173
the keysym names are evaluated as the line is read in. This allows you to
174
remove keys from a modifier without having to worry about whether or not they
175
have been reassigned.
177
.B "pointer = default"
178
This sets the pointer map back to its default settings (button 1 generates a
179
code of 1, button 2 generates a 2, etc.).
181
.B pointer = \fINUMBER ...\fP
182
This sets the pointer map to contain the indicated button codes. The list
183
always starts with the first physical button.
185
Lines that begin with an exclamation point (!) are taken as comments.
187
If you want to change the binding of a modifier key, you must also remove it
188
from the appropriate modifier map.
191
Many pointers are designed such that the first button is pressed using the
192
index finger of the right hand. People who are left-handed frequently find
193
that it is more comfortable to reverse the button codes that get generated
194
so that the primary button is pressed using the index finger of the left hand.
195
This could be done on a 3 button pointer as follows:
197
% xmodmap -e "pointer = 3 2 1"
200
Many applications support the notion of Meta keys (similar to Control
201
keys except that Meta is held down instead of Control). However,
202
some servers do not have a Meta keysym in the default keymap table, so one
203
needs to be added by hand.
204
The following command will attach Meta to the Multi-language key (sometimes
205
labeled Compose Character). It also takes advantage of the fact that
206
applications that need a Meta key simply need to get the keycode and don't
207
require the keysym to be in the first column of the keymap table. This
208
means that applications that are looking for a Multi_key (including the
209
default modifier map) won't notice any change.
211
% xmodmap -e "keysym Multi_key = Multi_key Meta_L"
214
Similarly, some keyboards have an Alt key but no Meta key.
215
In that case the following may be useful:
217
% xmodmap -e "keysym Alt_L = Meta_L Alt_L"
220
One of the more simple, yet convenient, uses of \fIxmodmap\fP is to set the
221
keyboard's "rubout" key to generate an alternate keysym. This frequently
222
involves exchanging Backspace with Delete to be more comfortable to the user.
223
If the \fIttyModes\fP resource in \fIxterm\fP is set as well, all terminal
224
emulator windows will use the same key for erasing characters:
226
% xmodmap -e "keysym BackSpace = Delete"
227
% echo "XTerm*ttyModes: erase ^?" | xrdb -merge
230
Some keyboards do not automatically generate less than and greater than
231
characters when the comma and period keys are shifted. This can be remedied
232
with \fIxmodmap\fP by resetting the bindings for the comma and period with
233
the following scripts:
236
! make shift-, be < and shift-. be >
238
keysym comma = comma less
239
keysym period = period greater
242
One of the more irritating differences between keyboards is the location of the
243
Control and Shift Lock keys. A common use of \fIxmodmap\fP is to swap these
247
! Swap Caps_Lock and Control_L
249
remove Lock = Caps_Lock
250
remove Control = Control_L
251
keysym Control_L = Caps_Lock
252
keysym Caps_Lock = Control_L
254
add Control = Control_L
257
This example can be run again to swap the keys back to their previous
260
The \fIkeycode\fP command is useful for assigning the same keysym to
261
multiple keycodes. Although unportable, it also makes it possible to write
262
scripts that can reset the keyboard to a known state. The following script
263
sets the backspace key to generate Delete (as shown above), flushes all
264
existing caps lock bindings, makes the CapsLock
265
key be a control key, make F5 generate Escape, and makes Break/Reset be a
269
! On the HP, the following keycodes have key caps as listed:
279
keycode 55 = Control_R
281
add Control = Control_R
283
keycode 15 = Caps_Lock
290
to get default host and display number.
292
X(__miscmansuffix__), xev(1), \fIXlib\fP documentation on key and pointer events
295
Every time a \fBkeycode\fP expression is evaluated, the server generates
296
a \fIMappingNotify\fP event on every client. This can cause some thrashing.
297
All of the changes should be batched together and done at once.
298
Clients that receive keyboard input and ignore \fIMappingNotify\fP events
299
will not notice any changes made to keyboard mappings.
302
should generate "add" and "remove" expressions automatically
303
whenever a keycode that is already bound to a modifier is changed.
305
There should be a way to have the
307
expression accept keycodes as well as keysyms for those times when you really
308
mess up your mappings.
310
Jim Fulton, MIT X Consortium, rewritten from an earlier version by
311
David Rosenthal of Sun Microsystems.