Tizen 2.0 Release
[framework/uifw/xorg/util/x11-xserver-utils.git] / xmodmap / man / xmodmap.man
1 .\" Copyright (c) 1987, 2010, Oracle and/or its affiliates. All rights reserved.
2 .\"
3 .\" Permission is hereby granted, free of charge, to any person obtaining a
4 .\" copy of this software and associated documentation files (the "Software"),
5 .\" to deal in the Software without restriction, including without limitation
6 .\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 .\" and/or sell copies of the Software, and to permit persons to whom the
8 .\" Software is furnished to do so, subject to the following conditions:
9 .\"
10 .\" The above copyright notice and this permission notice (including the next
11 .\" paragraph) shall be included in all copies or substantial portions of the
12 .\" Software.
13 .\"
14 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 .\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 .\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17 .\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 .\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 .\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 .\" DEALINGS IN THE SOFTWARE.
21 .\"
22 .\" Copyright 1988, 1989, 1990, 1998  The Open Group
23 .\" 
24 .\" Permission to use, copy, modify, distribute, and sell this software and its
25 .\" documentation for any purpose is hereby granted without fee, provided that
26 .\" the above copyright notice appear in all copies and that both that
27 .\" copyright notice and this permission notice appear in supporting
28 .\" documentation.
29 .\" 
30 .\" The above copyright notice and this permission notice shall be included
31 .\" in all copies or substantial portions of the Software.
32 .\" 
33 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
34 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
35 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
36 .\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
37 .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
38 .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
39 .\" OTHER DEALINGS IN THE SOFTWARE.
40 .\" 
41 .\" Except as contained in this notice, the name of The Open Group shall
42 .\" not be used in advertising or otherwise to promote the sale, use or
43 .\" other dealings in this Software without prior written authorization
44 .\" from The Open Group.
45 .\" 
46 .de EX          \"Begin example
47 .ne 5
48 .if n .sp 1
49 .if t .sp .5
50 .nf
51 .in +.5i
52 ..
53 .de EE
54 .fi
55 .in -.5i
56 .if n .sp 1
57 .if t .sp .5
58 ..
59 .TH XMODMAP 1 __xorgversion__
60 .SH NAME
61 xmodmap - utility for modifying keymaps and pointer button mappings in X
62 .SH SYNOPSIS
63 .B xmodmap
64 [-options ...] [filename]
65 .SH DESCRIPTION
66 .PP
67 The \fIxmodmap\fP program is used to edit and display the 
68 keyboard \fImodifier map\fP and \fIkeymap table\fP that are used by client 
69 applications to convert event keycodes into keysyms.  It is usually run from 
70 the user's session startup script to configure the keyboard according to 
71 personal tastes.
72 .SH OPTIONS
73 .PP
74 The following options may be used with \fIxmodmap\fP:
75 .TP 8
76 .B \-display \fIdisplay\fP
77 This option specifies the host and display to use.
78 .TP 8
79 .B \-help
80 This option indicates that a brief description of the command line arguments
81 should be printed on the standard error channel.  This will be done whenever an
82 unhandled argument is given to
83 .I xmodmap.
84 .TP 8
85 .B \-grammar
86 This option indicates that a help message describing the expression grammar 
87 used in files and with \-e expressions should be printed on the standard error.
88 .TP 8
89 .B \-verbose
90 This option indicates that 
91 .I xmodmap
92 should print logging information as it parses its input.
93 .TP 8
94 .B \-quiet
95 This option turns off the verbose logging.  This is the default.
96 .TP 8
97 .B \-n
98 This option indicates that 
99 .I xmodmap
100 should not change the mappings, but should display what it would do, like
101 \fImake(__appmansuffix__)\fP does when given this option.
102 .TP 8
103 .B \-e \fIexpression\fB
104 This option specifies an expression to be executed.  Any number of expressions
105 may be specified from the command line.
106 .TP 8
107 .B \-pm
108 This option indicates that the current modifier map should be printed on the
109 standard output.   This is the default mode of operation if no other mode
110 options are specified.
111 .TP 8
112 .B \-pk
113 This option indicates that the current keymap table should be printed on the
114 standard output.
115 .TP 8
116 .B \-pke
117 This option indicates that the current keymap table should be printed on the
118 standard output in the form of expressions that can be fed back to
119 \fIxmodmap\fP.
120 .TP 8
121 .B \-pp
122 This option indicates that the current pointer map should be printed on the
123 standard output.
124 .TP 8
125 .B \-
126 A lone dash means that the standard input should be used as the input file.
127 .PP
128 The \fIfilename\fP specifies a file containing \fIxmodmap\fP expressions
129 to be executed.  This file is usually kept in the user's home directory with
130 a name like \fI.xmodmaprc\fP.
131 .SH EXPRESSION GRAMMAR
132 .PP
133 The
134 .I xmodmap
135 program reads a list of expressions and parses them all before attempting
136 to execute any of them.  This makes it possible to refer to keysyms that are
137 being redefined in a natural way without having to worry as much about name
138 conflicts.
139 .PP
140 The list of keysym names may be found in the header file
141 \fI<X11/keysymdef.h>\fP (without the \fIXK_\fP prefix),
142 supplemented by the keysym database \fI __X11datadir__/XKeysymDB\fP.
143 Keysyms matching Unicode characters may be specified as "U0020" to "U007E"
144 and "U00A0" to "U10FFFF" for all possible Unicode characters.
145 .TP 8
146 .B keycode \fINUMBER\fP = \fIKEYSYMNAME ...\fP
147 The list of keysyms is assigned to the indicated keycode 
148 (which may be specified in decimal, hex or octal and can be determined by 
149 running the
150 .I xev
151 program).  Up to eight keysyms may be attached to a key, however the last four
152 are not used in any major X server implementation.  The first keysym is used
153 when no modifier key is pressed in conjunction with this key, the second with
154 Shift, the third when the Mode_switch key is used with this key and the fourth
155 when both the Mode_switch and Shift keys are used.
156 .TP 8
157 .B keycode any = \fIKEYSYMNAME ...\fP
158 If no existing key has the specified list of keysyms assigned to it,
159 a spare key on the keyboard is selected and the keysyms are assigned to it.
160 The list of keysyms may be specified in decimal, hex or octal.
161 .TP 8
162 .B keysym \fIKEYSYMNAME\fP = \fIKEYSYMNAME ...\fP
163 The \fIKEYSYMNAME\fP on the left hand side is translated into matching keycodes
164 used to perform the corresponding set of \fBkeycode\fP expressions.  Note that
165 if the same keysym is bound to multiple keys, the expression is executed
166 for each matching keycode.
167 .TP 8
168 .B clear \fIMODIFIERNAME\fP
169 This removes all entries in the modifier map for the given modifier, where 
170 valid name are:
171 .BR Shift ,
172 .BR Lock ,
173 .BR Control ,
174 .BR Mod1 ,
175 .BR Mod2 ,
176 .BR Mod3 ,
177 .BR Mod4 ,
178 and \fBMod5\fP (case 
179 does not matter in modifier names, although it does matter for all other
180 names).  For example, ``clear Lock'' will remove
181 all any keys that were bound to the shift lock modifier.
182 .TP 8
183 .B add \fIMODIFIERNAME\fP = \fIKEYSYMNAME ...\fP
184 This adds all keys containing the given keysyms to the indicated modifier map.
185 The keysym names
186 are evaluated after all input expressions are read to make it easy to write
187 expressions to swap keys (see the EXAMPLES section).
188 .TP 8
189 .B remove \fIMODIFIERNAME\fP = \fIKEYSYMNAME ...\fP
190 This removes all keys containing the given keysyms from the indicated
191 modifier map.  Unlike
192 .B add,
193 the keysym names are evaluated as the line is read in.  This allows you to
194 remove keys from a modifier without having to worry about whether or not they
195 have been reassigned.
196 .TP 8
197 .B "pointer = default"
198 This sets the pointer map back to its default settings (button 1 generates a 
199 code of 1, button 2 generates a 2, etc.).
200 .TP 8
201 .B pointer = \fINUMBER ...\fP
202 This sets the pointer map to contain the indicated button codes.  The list
203 always starts with the first physical button.  Setting a button code to 0
204 disables events from that button.
205 .PP
206 Lines that begin with an exclamation point (!) are taken as comments.
207 .PP
208 If you want to change the binding of a modifier key, you must also remove it
209 from the appropriate modifier map.
210 .SH EXAMPLES
211 .PP
212 Many pointers are designed such that the first button is pressed using the
213 index finger of the right hand.  People who are left-handed frequently find
214 that it is more comfortable to reverse the button codes that get generated
215 so that the primary button is pressed using the index finger of the left hand.
216 This could be done on a 3 button pointer as follows:
217 .EX
218 %  xmodmap -e "pointer = 3 2 1"
219 .EE
220 .PP
221 Many applications support the notion of Meta keys (similar to Control 
222 keys except that Meta is held down instead of Control).  However,
223 some servers do not have a Meta keysym in the default keymap table, so one
224 needs to be added by hand.
225 The following command will attach Meta to the Multi-language key (sometimes
226 labeled Compose Character).  It also takes advantage of the fact that 
227 applications that need a Meta key simply need to get the keycode and don't
228 require the keysym to be in the first column of the keymap table.  This
229 means that applications that are looking for a Multi_key (including the
230 default modifier map) won't notice any change.
231 .EX
232 %  xmodmap -e "keysym Multi_key = Multi_key Meta_L"
233 .EE
234 .PP
235 Similarly, some keyboards have an Alt key but no Meta key.
236 In that case the following may be useful:
237 .EX
238 %  xmodmap -e "keysym Alt_L = Meta_L Alt_L"
239 .EE
240 .PP
241 One of the more simple, yet convenient, uses of \fIxmodmap\fP is to set the
242 keyboard's "rubout" key to generate an alternate keysym.  This frequently
243 involves exchanging Backspace with Delete to be more comfortable to the user.
244 If the \fIttyModes\fP resource in \fIxterm\fP is set as well, all terminal 
245 emulator windows will use the same key for erasing characters:
246 .EX
247 %  xmodmap -e "keysym BackSpace = Delete"
248 %  echo "XTerm*ttyModes:  erase ^?" | xrdb -merge
249 .EE
250 .PP
251 Some keyboards do not automatically generate less than and greater than
252 characters when the comma and period keys are shifted.  This can be remedied
253 with \fIxmodmap\fP by resetting the bindings for the comma and period with
254 the following scripts:
255 .EX
256 !
257 ! make shift-, be < and shift-. be >
258 !
259 keysym comma = comma less
260 keysym period = period greater
261 .EE
262 .PP
263 One of the more irritating differences between keyboards is the location of the
264 Control and Shift Lock keys.  A common use of \fIxmodmap\fP is to swap these
265 two keys as follows:
266 .EX
267 !
268 ! Swap Caps_Lock and Control_L
269 !
270 remove Lock = Caps_Lock
271 remove Control = Control_L
272 keysym Control_L = Caps_Lock
273 keysym Caps_Lock = Control_L
274 add Lock = Caps_Lock
275 add Control = Control_L
276 .EE
277 .PP
278 This example can be run again to swap the keys back to their previous 
279 assignments.
280 .PP
281 The \fIkeycode\fP command is useful for assigning the same keysym to
282 multiple keycodes.  Although unportable, it also makes it possible to write
283 scripts that can reset the keyboard to a known state.  The following script
284 sets the backspace key to generate Delete (as shown above), flushes all 
285 existing caps lock bindings, makes the CapsLock
286 key be a control key, make F5 generate Escape, and makes Break/Reset be a
287 shift lock.
288 .EX
289 !
290 ! On the HP, the following keycodes have key caps as listed:
291 !
292 !     101  Backspace
293 !      55  Caps
294 !      14  Ctrl
295 !      15  Break/Reset
296 !      86  Stop
297 !      89  F5
298 !
299 keycode 101 = Delete
300 keycode 55 = Control_R
301 clear Lock
302 add Control = Control_R
303 keycode 89 = Escape
304 keycode 15 = Caps_Lock
305 add Lock = Caps_Lock
306 .EE
307 .SH ENVIRONMENT
308 .PP
309 .TP 8
310 .B DISPLAY
311 to get default host and display number.
312 .SH SEE ALSO
313 X(__miscmansuffix__), xev(__appmansuffix__), setxkbmap(__appmansuffix__),
314 XStringToKeysym(__libmansuffix__),
315 \fIXlib\fP documentation on key and pointer events
316 .SH BUGS
317 .PP
318 Every time a \fBkeycode\fP expression is evaluated, the server generates
319 a \fIMappingNotify\fP event on every client.  This can cause some thrashing.
320 All of the changes should be batched together and done at once.
321 Clients that receive keyboard input and ignore \fIMappingNotify\fP events
322 will not notice any changes made to keyboard mappings.
323 .PP
324 .I Xmodmap
325 should generate "add" and "remove" expressions automatically
326 whenever a keycode that is already bound to a modifier is changed.
327 .PP
328 There should be a way to have the
329 .I remove
330 expression accept keycodes as well as keysyms for those times when you really
331 mess up your mappings.
332 .SH AUTHOR
333 Jim Fulton, MIT X Consortium, rewritten from an earlier version by
334 David Rosenthal of Sun Microsystems.
335