1KEYMAPS(5)                    File Formats Manual                   KEYMAPS(5)
2
3
4

NAME

6       keymaps - keyboard table descriptions for loadkeys and dumpkeys
7

DESCRIPTION

9       These  files  are  used by loadkeys(1) to modify the translation tables
10       used by the kernel keyboard driver and generated  by  dumpkeys(1)  from
11       those translation tables.
12
13       The  format  of  these  files is vaguely similar to the one accepted by
14       xmodmap(1).  The file consists of charset or key or  string  definition
15       lines interspersed with comments.
16
17       Comments are introduced with !  or # characters and continue to the end
18       of the line. Anything following one of these characters on that line is
19       ignored.  Note  that  comments  need  not begin from column one as with
20       xmodmap(1).
21
22       The syntax of keymap files is line oriented; a complete definition must
23       fit on a single logical line. Logical lines can, however, be split into
24       multiple physical lines by ending each subline with the backslash char‐
25       acter (\).
26

INCLUDE FILES

28       A keymap can include other keymaps using the syntax
29
30              include "pathname"
31

CHARSET DEFINITIONS

33       A character set definition line is of the form:
34
35              charset "iso-8859-x"
36
37       It  defines  how following keysyms are to be interpreted.  For example,
38       in iso-8859-1 the  symbol  mu  (or  micro)  has  code  0265,  while  in
39       iso-8859-7 the letter mu has code 0354.
40

COMPLETE KEYCODE DEFINITIONS

42       Each complete key definition line is of the form:
43
44              keycode keynumber = keysym keysym keysym...
45
46       keynumber  is  the  internal  identification number of the key, roughly
47       equivalent to the scan code of it.  keynumber can be given in  decimal,
48       octal  or hexadecimal notation.  Octal is denoted by a leading zero and
49       hexadecimal by the prefix 0x.
50
51       Each of the keysyms represent keyboard actions, of which up to 256  can
52       be  bound  to  a  single  key. The actions available include outputting
53       character codes or character sequences, switching consoles or  keymaps,
54       booting  the machine etc. (The complete list can be obtained from dump‐
55       keys(1) by saying  dumpkeys -l .)
56
57       Each keysym may be prefixed by a '+' (plus sign),  in  wich  case  this
58       keysym  is  treated  as  a "letter" and therefore affected by the "Cap‐
59       sLock" the same way as by "Shift" (to be correct, the CapsLock  inverts
60       the  Shift  state).   The  ASCII letters ('a'-'z' and 'A'-'Z') are made
61       CapsLock'able by default.  If Shift+CapsLock should not produce a lower
62       case symbol, put lines like
63
64              keycode 30 = +a  A
65
66       in the map file.
67
68       Which  of  the actions bound to a given key is taken when it is pressed
69       depends on what modifiers are in effect at that moment.   The  keyboard
70       driver  supports  8  modifiers. These modifiers are labeled (completely
71       arbitrarily) Shift, AltGr, Control,  Alt,  ShiftL,  ShiftR,  CtrlL  and
72       CtrlR.   Each  of  these modifiers has an associated weight of power of
73       two according to the following table:
74
75              modifier                weight
76
77              Shift
78                                        1
79              AltGr
80                                        2
81              Control
82                                        4
83              Alt
84                                        8
85              ShiftL
86                                       16
87              ShiftR
88                                       32
89              CtrlL
90                                       64
91              CtrlR                   128
92
93       The effective action of a key is found out by adding up the weights  of
94       all the modifiers in effect. By default, no modifiers are in effect, so
95       action number zero, i.e. the one in the first column in a  key  defini‐
96       tion  line,  is  taken  when  the key is pressed or released. When e.g.
97       Shift and Alt modifiers are in effect, action  number  nine  (from  the
98       10th column) is the effective one.
99
100       Changing  the  state of what modifiers are in effect can be achieved by
101       binding appropriate key actions to desired keys. For  example,  binding
102       the  symbol  Shift to a key sets the Shift modifier in effect when that
103       key is pressed and cancels the effect of that modifier when the key  is
104       released. Binding AltGr_Lock to a key sets AltGr in effect when the key
105       is pressed and cancels the effect when the key is pressed  again.   (By
106       default Shift, AltGr, Control and Alt are bound to the keys that bear a
107       similar label; AltGr may denote the right Alt key.)
108
109       Note that you should be very careful when binding  the  modifier  keys,
110       otherwise  you can end up with an unusable keyboard mapping. If you for
111       example define a key to have Control in its first column and leave  the
112       rest  of  the  columns  to  be  VoidSymbols, you're in trouble. This is
113       because pressing the key puts Control modifier in effect and  the  fol‐
114       lowing  actions  are  looked  up  from  the fifth column (see the table
115       above). So, when you release the key, the action from the fifth  column
116       is  taken. It has VoidSymbol in it, so nothing happens. This means that
117       the Control modifier is still in effect, although you have released the
118       key.   Re-pressing  and releasing the key has no effect. To avoid this,
119       you should always define all the columns to have the same modifier sym‐
120       bol. There is a handy short-hand notation for this, see below.
121
122       keysyms  can  be  given in decimal, octal, hexadecimal, unicode or sym‐
123       bolic notation.  The numeric notations use  the  same  format  as  with
124       keynumber.   Unicode notation is "U+" followed by four hexadecimal dig‐
125       its.  The symbolic notation resembles that used by xmodmap(1).  Notable
126       differences  are  the number symbols. The numeric symbols '0', ..., '9'
127       of xmodmap(1) are replaced with the corresponding words 'zero',  'one',
128       ... 'nine' to avoid confusion with the numeric notation.
129
130       It  should  be  noted  that  using  numeric notation for the keysyms is
131       highly unportable as the key action numbers may vary  from  one  kernel
132       version  to  another  and the use of numeric notations is thus strongly
133       discouraged. They are intended to be used only when you know there is a
134       supported keyboard action in your kernel for which your current version
135       of loadkeys(1) has no symbolic name.
136
137       There is a number of short-hand notations to add readability and reduce
138       typing work and the probability of typing-errors.
139
140       First of all, you can give a map specification line, of the form
141
142              keymaps 0-2,4-5,8,12
143
144       to  indicate that the lines of the keymap will not specify all 256 col‐
145       umns, but only the indicated ones. (In the  example:  only  the  plain,
146       Shift,  AltGr,  Control,  Control+Shift, Alt and Control+Alt maps, that
147       is, 7 columns instead of 256.)  When no such line is given, the keymaps
148       0-M  will  be defined, where M+1 is the maximum number of entries found
149       in any definition line.
150
151       Next, you can leave off any trailing VoidSymbol entries from a key def‐
152       inition  line.  VoidSymbol  denotes a keyboard action which produces no
153       output and has no other effects either. For example, to define key num‐
154       ber  30  to  output  'a'  unshifted, 'A' when pressed with Shift and do
155       nothing when pressed with AltGr or other modifiers, you can write
156
157              keycode  30 = a     A
158
159       instead of the more verbose
160
161              keycode  30 = a     A    VoidSymbol     VoidSymbol \
162                        VoidSymbol VoidSymbol VoidSymbol ...
163
164       For added convenience, you can usually get off with  still  more  terse
165       definitions.  If  you enter a key definition line with only and exactly
166       one action code after the equals sign, it has a special meaning. If the
167       code (numeric or symbolic) is not an ASCII letter, it means the code is
168       implicitly replicated through all columns being defined.   If,  on  the
169       other  hand,  the  action  code is an ASCII character in the range 'a',
170       ..., 'z' or 'A', ..., 'Z' in the ASCII collating sequence, the  follow‐
171       ing  definitions are made for the different modifier combinations, pro‐
172       vided these are actually being defined.  (The table lists the two  pos‐
173       sible  cases:  either  the  single  action code is a lower case letter,
174       denoted by 'x' or an upper case letter, denoted by 'Y'.)
175
176           modifier                symbol
177
178           none                    x              Y
179           Shift                   X              y
180           AltGr                   x              Y
181           Shift+AltGr             X              y
182           Control                 Control_x      Control_y
183           Shift+Control           Control_x      Control_y
184           AltGr+Control           Control_x      Control_y
185           Shift+AltGr+Control     Control_x      Control_y
186           Alt                     Meta_x         Meta_Y
187           Shift+Alt               Meta_X         Meta_y
188           AltGr+Alt               Meta_x         Meta_Y
189           Shift+AltGr+Alt         Meta_X         Meta_y
190           Control+Alt             Meta_Control_x Meta_Control_y
191           Shift+Control+Alt       Meta_Control_x Meta_Control_y
192           AltGr+Control+Alt       Meta_Control_x Meta_Control_y
193           Shift+AltGr+Control+Alt Meta_Control_x Meta_Control_y
194

SINGLE MODIFIER DEFINITIONS

196       All the previous forms of key definition lines always  define  all  the
197       M+1  possible  modifier  combinations  being  defined, whether the line
198       actually contains that many action codes or not.  There is, however,  a
199       variation  of the definition syntax for defining only single actions to
200       a particular modifier combination of a key. This is especially  useful,
201       if  you load a keymap which doesn't match your needs in only some modi‐
202       fier combinations, like AltGr+function keys. You can then make a  small
203       local  file  redefining only those modifier combinations and loading it
204       after the main file.  The syntax of this form is:
205
206       { plain | <modifier sequence> } keycode keynumber = keysym
207
208       , e.g.,
209              plain keycode 14 = BackSpace
210              control alt keycode 83 = Boot
211              alt keycode 105 = Decr_Console
212              alt keycode 106 = Incr_Console
213       Using "plain" will define only the base entry of a key  (i.e.  the  one
214       with  no  modifiers  in effect) without affecting the bindings of other
215       modifier combinations of that key.
216

STRING DEFINITIONS

218       In addition to comments and key definition lines, a keymap can  contain
219       string  definitions.  These  are  used to define what each function key
220       action code sends. The syntax of string definitions is:
221
222              string keysym = "text"
223
224       text can contain literal characters, octal character codes in the  for‐
225       mat  of  backslash  followed by up to three octal digits, and the three
226       escape sequences \n, \\, and \",  for  newline,  backslash  and  quote,
227       respectively.
228

COMPOSE DEFINITIONS

230       Then there may also be compose definitions. They have syntax
231
232              compose 'char' 'char' to 'char'
233       and  describe  how  two  bytes are combined to form a third one (when a
234       dead accent or compose key is used).  This is used to get accented let‐
235       ters and the like on a standard keyboard.
236

ABBREVIATIONS

238       Various abbreviations can be used with kbd-0.96 and later.
239
240       strings as usual
241              Defines  the  usual values of the strings (but not the keys they
242              are bound to).
243
244       compose as usual for "iso-8859-1"
245              Defines the usual compose combinations.
246
247       To find out what keysyms there are available for use  in  keymaps,  use
248       the command
249
250              dumpkeys --long-info
251
252       Unfortunately,  there  is  currently no description of what each symbol
253       does. It has to be guessed from the name or figured out from the kernel
254       sources.
255

EXAMPLES

257       (Be  careful  to use a keymaps line, like the first line of `dumpkeys`,
258       or "keymaps 0-15" or so.)
259
260       The following entry exchanges the left Control key and  the  Caps  Lock
261       key on the keyboard:
262
263              keycode  58 = Control
264              keycode  29 = Caps_Lock
265
266       Key  number 58 is normally the Caps Lock key, and key number 29 is nor‐
267       mally the Control key.
268
269       The following entry sets the Shift and Caps Lock keys  to  behave  more
270       nicely, like in older typewriters. That is, pressing Caps Lock key once
271       or more sets the keyboard in CapsLock state and pressing either of  the
272       Shift keys releases it.
273
274              keycode  42 = Uncaps_Shift
275              keycode  54 = Uncaps_Shift
276              keycode  58 = Caps_On
277
278       The  following  entry  sets  the layout of the edit pad in the enhanced
279       keyboard to be more like that in the VT200 series terminals:
280
281              keycode 102 = Insert
282              keycode 104 = Remove
283              keycode 107 = Prior
284              shift keycode 107 = Scroll_Backward
285              keycode 110 = Find
286              keycode 111 = Select
287              control alt   keycode 111 = Boot
288              control altgr keycode 111 = Boot
289
290       Here's an example to bind the string "du\ndf\n" to the key AltGr-D.  We
291       use the "spare" action code F100 not normally bound to any key.
292
293              altgr keycode 32 = F100
294              string F100 = "du\ndf\n"
295

SEE ALSO

297       loadkeys(1), dumpkeys(1), showkey(1), xmodmap(1)
298
299
300
301                                 24 April 1998                      KEYMAPS(5)
Impressum