Penguin
Annotated edit history of keymaps(5) version 2, including all changes. View license author blame.
Rev Author # Line
1 perry 1 KEYMAPS
2 !!!KEYMAPS
3 NAME
4 DESCRIPTION
5 INCLUDE FILES
6 CHARSET DEFINITIONS
7 COMPLETE KEYCODE DEFINITIONS
8 SINGLE MODIFIER DEFINITIONS
9 STRING DEFINITIONS
10 COMPOSE DEFINITIONS
11 ABBREVIATIONS
12 EXAMPLES
13 SEE ALSO
14 ----
15 !!NAME
16
17
18 keymaps - keyboard table descriptions for loadkeys and dumpkeys
19 !!DESCRIPTION
20
21
22 These files are used by loadkeys(1) to modify the
23 translation tables used by the kernel keyboard driver and
24 generated by dumpkeys(1) from those translation
25 tables.
26
27
28 The format of these files is vaguely similar to the one
29 accepted by xmodmap(1). The file consists of charset
30 or key or string definition lines interspersed with
31 comments.
32
33
34 Comments are introduced with __!__ or __#__ characters
35 and continue to the end of the line. Anything following one
36 of these characters on that line is ignored. Note that
37 comments need not begin from column one as with
38 xmodmap(1).
39
40
41 The syntax of keymap files is line oriented; a complete
42 definition must fit on a single logical line. Logical lines
43 can, however, be split into multiple physical lines by
44 ending each subline with the backslash character
45 ().
46 !!INCLUDE FILES
47
48
49 A keymap can include other keymaps using the
50 syntax
51
52
53 include
54 !!CHARSET DEFINITIONS
55
56
57 A character set definition line is of the form:
58
59
60 __charset__ ''''
61
62
63 Where '''' is one of the currently
64 supported charsets, which can be found using __dumpkeys
65 --help__. It defines how following keysyms are to be
66 interpreted. For example, in iso-8859-1 the symbol mu (or
67 micro) has code 0265, while in iso-8859-7 the letter mu has
68 code 0354.
69 !!COMPLETE KEYCODE DEFINITIONS
70
71
72 Each complete key definition line is of the
73 form:
74
75
76 __keycode__ ''keynumber'' __=__ ''keysym keysym
77 keysym''...
78
79
80 ''keynumber'' is the internal identification number of
81 the key, roughly equivalent to the scan code of it.
82 ''keynumber'' can be given in decimal, octal or
83 hexadecimal notation. Octal is denoted by a leading zero and
84 hexadecimal by the prefix __0x__.
85
86
87 Each of the ''keysyms'' represent keyboard actions, of
88 which up to 256 can be bound to a single key. The actions
89 available include outputting Latin1 character codes or
90 character sequences, switching consoles or keymaps, booting
91 the machine etc. (The complete list can be obtained from
92 dumpkeys(1) by saying __dumpkeys -l__).
93
94
95 Each ''keysym'' may be prefixed by a '+' (plus sign), in
96 which case this keysym is treated as a
97 ''
98
99
100 __keycode 30 = +a A__
101
102
103 in the map file.
104
105
106 Which of the actions bound to a given key is taken when it
107 is pressed depends on what modifiers are in effect at that
108 moment. The keyboard driver supports 8 modifiers. These
2 perry 109 modifiers are labeled (completely arbitrarily) Shift, !AltGr,
1 perry 110 Control, Alt, ShiftL, ShiftR, CtrlL and CtrlR. Each of these
111 modifiers has an associated weight of power of two according
112 to the following table:
113
114
115 ''modifier weight''
116
117
118 Shift 1
119
120
2 perry 121 !AltGr 2
1 perry 122
123
124 Control 4
125
126
127 Alt 8
128
129
130 ShiftL 16
131
132
133 ShiftR 32
134
135
136 CtrlL 64
137
138
139 CtrlR 128
140
141
142 The effective action of a key is found out by adding up the
143 weights of all the modifiers in effect. By default, no
144 modifiers are in effect, so action number zero, i.e. the one
145 in the first column in a key definition line, is taken when
146 the key is pressed or released. When e.g. Shift and Alt
147 modifiers are in effect, action number nine (from the 10th
148 column) is the effective one.
149
150
151 Changing the state of what modifiers are in effect can be
152 achieved by binding appropriate key actions to desired keys.
153 For example, binding the symbol Shift to a key sets the
154 Shift modifier in effect when that key is pressed and
155 cancels the effect of that modifier when the key is
2 perry 156 released. Binding !AltGr_Lock to a key sets !AltGr in effect
1 perry 157 when the key is pressed and cancels the effect when the key
2 perry 158 is pressed again. (By default Shift, !AltGr, Control and Alt
159 are bound to the keys that bear a similar label; !AltGr may
1 perry 160 denote the right Alt key.)
161
162
163 Note that you should be very careful when binding the
164 modifier keys, otherwise you can end up with an unusable
165 keyboard mapping. If you for example define a key to have
166 Control in its first column and leave the rest of the
2 perry 167 columns to be !VoidSymbols, you're in trouble. This is
1 perry 168 because pressing the key puts Control modifier in effect and
169 the following actions are looked up from the fifth column
170 (see the table above). So, when you release the key, the
2 perry 171 action from the fifth column is taken. It has !VoidSymbol in
1 perry 172 it, so nothing happens. This means that the Control modifier
173 is still in effect, although you have released the key.
174 Re-pressing and releasing the key has no effect. To avoid
175 this, you should always define all the columns to have the
176 same modifier symbol. There is a handy short-hand notation
177 for this, see below.
178
179
180 ''keysyms'' can be given in decimal, octal, hexadecimal
181 or symbolic notation. The numeric notations use the same
182 format as with ''keynumber''. The symbolic notation
183 resembles that used by xmodmap(1). Notable
184 differences are the number symbols. The numeric symbols '0',
185 ..., '9' of xmodmap(1) are replaced with the
186 corresponding words 'zero', 'one', ... 'nine' to avoid
187 confusion with the numeric notation.
188
189
190 It should be noted that using numeric notation for the
191 ''keysyms'' is highly unportable as the key action
192 numbers may vary from one kernel version to another and the
193 use of numeric notations is thus strongly discouraged. They
194 are intended to be used only when you know there is a
195 supported keyboard action in your kernel for which your
196 current version of loadkeys(1) has no symbolic
197 name.
198
199
200 There is a number of short-hand notations to add readability
201 and reduce typing work and the probability of
202 typing-errors.
203
204
205 First of all, you can give a map specification line, of the
206 form
207
208
209 __keymaps__ ''0-2,4-5,8,12''
210
211
212 to indicate that the lines of the keymap will not specify
213 all 256 columns, but only the indicated ones. (In the
2 perry 214 example: only the plain, Shift, !AltGr, Control,
1 perry 215 Control+Shift, Alt and Control+Alt maps, that is, 7 columns
216 instead of 256.) When no such line is given, the keymaps 0-M
217 will be defined, where M+1 is the maximum number of entries
218 found in any definition line.
219
220
2 perry 221 Next, you can leave off any trailing !VoidSymbol entries from
222 a key definition line. !VoidSymbol denotes a keyboard action
1 perry 223 which produces no output and has no other effects either.
224 For example, to define key number 30 to output 'a'
225 unshifted, 'A' when pressed with Shift and do nothing when
2 perry 226 pressed with !AltGr or other modifiers, you can
1 perry 227 write
228
229
230 __keycode__ ''30'' __=__ ''a A''
231
232
233 instead of the more verbose
234
235
2 perry 236 keycode 30 = a A !VoidSymbol !VoidSymbol \
237 !VoidSymbol !VoidSymbol !VoidSymbol ...
1 perry 238
239
240 For added convenience, you can usually get off with still
241 more terse definitions. If you enter a key definition line
242 with only and exactly one action code after the equals sign,
243 it has a special meaning. If the code (numeric or symbolic)
244 is not an ASCII letter, it means the code is implicitly
245 replicated through all columns being defined. If, on the
246 other hand, the action code is an ASCII character in the
247 range 'a', ..., 'z' or 'A', ..., 'Z' in the ASCII collating
248 sequence, the following definitions are made for the
249 different modifier combinations, provided these are actually
250 being defined. (The table lists the two possible cases:
251 either the single action code is a lower case letter,
252 denoted by 'x' or an upper case letter, denoted by
253 'Y'.)
254
255
256 ''modifier symbol''
257
258
259 none x Y
260
261
262 Shift X y
263
264
2 perry 265 !AltGr x Y
1 perry 266
267
2 perry 268 Shift+!AltGr X y
1 perry 269
270
271 Control Control_x Control_y
272
273
274 Shift+Control
275
276
277 Control_x Control_y
278
279
2 perry 280 !AltGr+Control
1 perry 281
282
283 Control_x Control_y
284
285
2 perry 286 Shift+!AltGr+Control
1 perry 287
288
289 Control_x Control_y
290
291
292 Alt Meta_x Meta_Y
293
294
295 Shift+Alt Meta_X Meta_y
296
297
2 perry 298 !AltGr+Alt Meta_x Meta_Y
1 perry 299
300
2 perry 301 Shift+!AltGr+Alt
1 perry 302
303
304 Meta_X Meta_y
305
306
307 Control+Alt Meta_Control_x Meta_Control_y
308
309
310 Shift+Control+Alt
311
312
313 Meta_Control_x Meta_Control_y
314
315
2 perry 316 !AltGr+Control+Alt
1 perry 317
318
319 Meta_Control_x Meta_Control_y
320
321
2 perry 322 Shift+!AltGr+Control+Alt
1 perry 323
324
325 Meta_Control_x Meta_Control_y
326 !!SINGLE MODIFIER DEFINITIONS
327
328
329 All the previous forms of key definition lines always define
330 all the M+1 possible modifier combinations being defined,
331 whether the line actually contains that many action codes or
332 not. There is, however, a variation of the definition syntax
333 for defining only single actions to a particular modifier
334 combination of a key. This is especially useful, if you load
335 a keymap which doesn't match your needs in only some
2 perry 336 modifier combinations, like !AltGr+function keys. You can
1 perry 337 then make a small local file redefining only those modifier
338 combinations and loading it after the main file. The syntax
339 of this form is:
340
341
342 { __plain__ | __keycode__
343 ''keynumber'' __=__ ''keysym''
344
345
346 e.g.,
347
348
2 perry 349 plain keycode 14 = !BackSpace
1 perry 350 control alt keycode 83 = Boot
351 alt keycode 105 = Decr_Console
352 alt keycode 106 = Incr_Console
353
354
355 Using
356 !!STRING DEFINITIONS
357
358
359 In addition to comments and key definition lines, the keymap
360 files can contain string definitions. These are used to
361 define what each function key action code sends. The syntax
362 of string definitions is:
363
364
365 __string__ ''keysym'' __=__
366 ''text''
367
368
369 ''text'' can contain literal characters, octal character
370 codes in the format of backslash followed by up to three
371 octal digits, and the three escape sequences __n__,
372 __\__, and ____, for newline, backslash and
373 quote, respectively.
374 !!COMPOSE DEFINITIONS
375
376
377 Then there may also be compose definitions. They have
378 syntax
379
380
381 __compose '__''char''__' '__''char''__' to
382 '__''char''__'__
383
384
385 and describe how two bytes are combined to form a third one
386 (when a dead accent or compose key is used). This is used to
387 get accented letters and the like on a standard
388 keyboard.
389 !!ABBREVIATIONS
390
391
392 Various abbreviations can be used with kbd-0.96 and
393 later.
394
395
396 __strings as usual__
397
398
399 Defines the usual values of the strings (but not the keys
400 they are bound to).
401
402
403 __compose as usual for
404 __
405
406
407 Defines the usual compose combinations.
408
409
410 __alt_is_meta__
411
412
413 Whenever some combination is defined as an ASCII symbol, and
414 there is a corresponding Alt keymap, define by default the
415 corresponding Alt combination as Meta_value.
416
417
418 To find out what ''keysyms'' there are available for use
419 in keymaps files, use the command
420
421
422 __dumpkeys --long-info__
423
424
425 Unfortunately, there is currently no description of what
426 each symbol does. It has to be guessed from the name or
427 figured out from the kernel sources.
428 !!EXAMPLES
429
430
431 (Be careful to use a keymaps line, like the first line of
432 `dumpkeys`, or
433
434
435 The following entry exchanges the left Control key and the
436 Caps Lock key on the keyboard:
437
438
439 keycode 58 = Control
440 keycode 29 = Caps_Lock
441
442
443 Key number 58 is normally the Caps Lock key, and key number
444 29 is normally the Control key.
445
446
447 The following entry sets the Shift and Caps Lock keys to
448 behave more nicely, like in older typewriters. That is,
449 pressing Caps Lock key once or more sets the keyboard in
2 perry 450 !CapsLock state and pressing either of the Shift keys
1 perry 451 releases it.
452
453
454 keycode 42 = Uncaps_Shift
455 keycode 54 = Uncaps_Shift
456 keycode 58 = Caps_On
457
458
459 The following entry sets the layout of the edit pad in the
460 enhanced keyboard to be more like that in the VT200 series
461 terminals:
462
463
464 keycode 102 = Insert
465 keycode 104 = Remove
466 keycode 107 = Prior
467 shift keycode 107 = Scroll_Backward
468 keycode 110 = Find
469 keycode 111 = Select
470 control alt keycode 111 = Boot
471 control altgr keycode 111 = Boot
472
473
474 Here's an example to bind the string
475
476
477 altgr keycode 32 = F100
478 string F100 =
479 !!SEE ALSO
480
481
482 loadkeys(1), dumpkeys(1), showkey(1),
483 xmodmap(1).
484 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.