1 .\" keymaps.5 - Copyright (C) Andries Brouwer 1998
2 .\" May be freely distributed.
3 .\" @(#)keymaps.5 1.10 940130 aeb
4 .TH KEYMAPS 5 "24 April 1998"
6 keymaps \- keyboard table descriptions for loadkeys and dumpkeys
8 .IX "keymaps" "" "\fLkeymaps\fR \(em keyboard table descriptions for loadkeys and dumpkeys" ""
9 .IX "loadkeys" "keyboard table descriptions" "\fLloadkeys\fR" "keyboard table descriptions"
10 .IX "dumpkeys" "keyboard table descriptions" "\fLdumpkeys\fR" "keyboard table descriptions"
11 .IX keyboard "table descriptions for loadkeys and dumpkeys" keyboard "table descriptions for \fLloadkeys\fR and \fLdumpkeys\fR"
12 .IX "translation tables"
14 These files are used by
16 to modify the translation tables used by the kernel keyboard driver
19 from those translation tables.
21 The format of these files is vaguely similar to the one accepted by
23 The file consists of charset or key or string definition lines
24 interspersed with comments.
26 Comments are introduced with
30 characters and continue to the end of the line. Anything following one
31 of these characters on that line is ignored. Note that comments need
32 not begin from column one as with
35 The syntax of keymap files is line oriented; a complete definition
36 must fit on a single logical line. Logical lines can, however, be split
37 into multiple physical lines by ending each subline with the backslash
40 A keymap can include other keymaps using the syntax
46 .SH "CHARSET DEFINITIONS"
47 A character set definition line is of the form:
55 It defines how following keysyms are to be interpreted.
56 For example, in iso-8859-1 the symbol mu (or micro) has code 0265,
57 while in iso-8859-7 the letter mu has code 0354.
58 .SH "COMPLETE KEYCODE DEFINITIONS"
59 Each complete key definition line is of the form:
63 .BI keycode " keynumber " = " keysym keysym keysym" \fR...
68 is the internal identification number of the key, roughly equivalent to
71 can be given in decimal, octal or hexadecimal notation.
72 Octal is denoted by a leading zero and hexadecimal by the prefix
77 represent keyboard actions, of which up to 256 can be bound to a single
78 key. The actions available include outputting character codes or
79 character sequences, switching consoles or keymaps, booting the machine
80 etc. (The complete list can be obtained from dumpkeys(1) by saying
86 may be prefixed by a '+' (plus sign), in wich case this keysym is treated
87 as a "letter" and therefore affected by the "CapsLock" the same way as by
88 "Shift" (to be correct, the CapsLock inverts the Shift state).
89 The ASCII letters ('a'-'z' and 'A'-'Z') are made CapsLock'able by default.
90 If Shift+CapsLock should not produce a lower case symbol, put lines like
94 .BI "keycode 30 = +a A"
100 Which of the actions bound to a given key is taken when it is pressed
101 depends on what modifiers are in effect at that moment.
102 The keyboard driver supports 8 modifiers. These modifiers are labeled
103 (completely arbitrarily) Shift, AltGr, Control, Alt, ShiftL, ShiftR,
105 Each of these modifiers has an associated weight of power of two
106 according to the following table:
140 The effective action of a key is found out by adding up the weights of
141 all the modifiers in effect. By default, no modifiers are in effect, so
142 action number zero, i.e. the one in the first column in a key definition
143 line, is taken when the key is pressed or released. When e.g. Shift and
144 Alt modifiers are in effect, action number nine (from the 10th column)
145 is the effective one.
147 Changing the state of what modifiers are in effect can be achieved by
148 binding appropriate key actions to desired keys. For example, binding
149 the symbol Shift to a key sets the Shift modifier in effect when that
150 key is pressed and cancels the effect of that modifier when the key is
151 released. Binding AltGr_Lock to a key sets AltGr in effect when the key
152 is pressed and cancels the effect when the key is pressed again.
153 (By default Shift, AltGr, Control and Alt are bound to the keys that bear
154 a similar label; AltGr may denote the right Alt key.)
156 Note that you should be very careful when binding the modifier keys,
157 otherwise you can end up with an unusable keyboard mapping. If you for
158 example define a key to have Control in its first column and leave the
159 rest of the columns to be VoidSymbols, you're in trouble. This is
160 because pressing the key puts Control modifier in effect and the
161 following actions are looked up from the fifth column (see the table
162 above). So, when you release the key, the action from the fifth column
163 is taken. It has VoidSymbol in it, so nothing happens. This means that
164 the Control modifier is still in effect, although you have released the key.
165 Re-pressing and releasing the key has no effect. To avoid this,
166 you should always define all the columns to have the same modifier
167 symbol. There is a handy short-hand notation for this, see below.
170 can be given in decimal, octal, hexadecimal, unicode or symbolic notation.
171 The numeric notations use the same format as with
173 Unicode notation is "U+" followed by four hexadecimal digits.
174 The symbolic notation resembles that used by
176 Notable differences are the number symbols. The numeric
177 symbols '0', ..., '9' of
179 are replaced with the corresponding words 'zero', 'one', ... 'nine' to
180 avoid confusion with the numeric notation.
182 It should be noted that using numeric notation for the
184 is highly unportable as the key action numbers may vary from one kernel
185 version to another and the use of numeric notations is thus strongly
186 discouraged. They are intended to be used only when you know there is a
187 supported keyboard action in your kernel for which your current version
190 has no symbolic name.
192 There is a number of short-hand notations to add readability and reduce
193 typing work and the probability of typing-errors.
195 First of all, you can give a map specification line, of the form
203 to indicate that the lines of the keymap will not specify all 256 columns,
204 but only the indicated ones. (In the example: only the plain, Shift,
205 AltGr, Control, Control+Shift, Alt and Control+Alt maps, that is, 7 columns
207 When no such line is given, the keymaps 0-M will be defined, where
208 M+1 is the maximum number of entries found in any definition line.
210 Next, you can leave off any trailing VoidSymbol entries from a key
211 definition line. VoidSymbol denotes a keyboard action which produces no
212 output and has no other effects either. For example, to define key
213 number 30 to output 'a' unshifted, 'A' when pressed with Shift and do
214 nothing when pressed with AltGr or other modifiers, you can write
222 instead of the more verbose
226 keycode 30 = a A VoidSymbol VoidSymbol \\
227 VoidSymbol VoidSymbol VoidSymbol ...
231 For added convenience, you can usually get off with still more terse
232 definitions. If you enter a key definition line with only and exactly
233 one action code after the equals sign, it has a special meaning. If the
234 code (numeric or symbolic) is not an ASCII letter, it means the code
235 is implicitly replicated through all columns being defined.
236 If, on the other hand, the action code is an ASCII character in the
237 range 'a', ..., 'z' or 'A', ..., 'Z' in the ASCII collating sequence,
238 the following definitions are made for the different modifier combinations,
239 provided these are actually being defined.
240 (The table lists the two possible cases:
241 either the single action code is a lower case letter,
242 denoted by 'x' or an upper case letter, denoted by 'Y'.)
287 Meta_Control_x Meta_Control_y
290 Meta_Control_x Meta_Control_y
293 Meta_Control_x Meta_Control_y
295 Shift+AltGr+Control+Alt
296 Meta_Control_x Meta_Control_y
300 .SH "SINGLE MODIFIER DEFINITIONS"
301 All the previous forms of key definition lines always define all the M+1
302 possible modifier combinations being defined, whether the line actually
303 contains that many action codes or not.
304 There is, however, a variation of the definition
305 syntax for defining only single actions to a particular modifier
306 combination of a key. This is especially useful, if you load a keymap
307 which doesn't match your needs in only some modifier combinations, like
308 AltGr+function keys. You can then make a small local file redefining
309 only those modifier combinations and loading it after the main file.
310 The syntax of this form is:
312 .BR "" { " plain " "| <modifier sequence> } " keycode
321 plain keycode 14 = BackSpace
322 control alt keycode 83 = Boot
323 alt keycode 105 = Decr_Console
324 alt keycode 106 = Incr_Console
328 Using "plain" will define only the base entry of a
329 key (i.e. the one with no modifiers in effect) without affecting the
330 bindings of other modifier combinations of that key.
331 .SH "STRING DEFINITIONS"
332 In addition to comments and key definition lines, a keymap can
333 contain string definitions. These are used to define what each function
334 key action code sends. The syntax of string definitions is:
345 can contain literal characters, octal character codes in the format of
346 backslash followed by up to three octal digits, and the three escape
347 sequences \fB\\n\fP, \fB\\\\\fP, and \fB\\"\fP,
348 for newline, backslash and quote, respectively.
349 .SH "COMPOSE DEFINITIONS"
350 Then there may also be compose definitions. They have syntax
353 .BI "compose '" char "' '" char "' to '" char "'"
355 and describe how two bytes are combined to form a third one
356 (when a dead accent or compose key is used).
357 This is used to get accented letters and the like on a standard
360 Various abbreviations can be used with kbd-0.96 and later.
362 .B "strings as usual"
363 Defines the usual values of the strings (but not the keys
366 \fBcompose as usual for "iso-8859-1"\fP
367 Defines the usual compose combinations.
371 there are available for use in keymaps, use the command
375 .B dumpkeys --long-info
379 Unfortunately, there is currently no description of what each symbol
380 does. It has to be guessed from the name or figured out from the kernel
384 (Be careful to use a keymaps line, like the first line of `dumpkeys`,
385 or "keymaps 0-15" or so.)
387 The following entry exchanges the left Control key and the Caps Lock
393 keycode 29 = Caps_Lock
397 Key number 58 is normally the Caps Lock key, and key number 29 is
398 normally the Control key.
400 The following entry sets the Shift and Caps Lock keys to behave more
401 nicely, like in older typewriters. That is, pressing Caps Lock key once
402 or more sets the keyboard in CapsLock state and pressing either of the
403 Shift keys releases it.
407 keycode 42 = Uncaps_Shift
408 keycode 54 = Uncaps_Shift
413 The following entry sets the layout of the edit pad in the enhanced
414 keyboard to be more like that in the VT200 series terminals:
421 shift keycode 107 = Scroll_Backward
424 control alt keycode 111 = Boot
425 control altgr keycode 111 = Boot
429 Here's an example to bind the string "du\\ndf\\n" to the key AltGr-D. We use
430 the "spare" action code F100 not normally bound to any key.
434 altgr keycode 32 = F100
435 string F100 = "du\\ndf\\n"