Blame docs/man/man5/keymaps.5

Packit Service 50ad14
.\" keymaps.5 - Copyright (C) Andries Brouwer 1998
Packit Service 50ad14
.\" May be freely distributed.
Packit Service 50ad14
.\" @(#)keymaps.5 1.10 940130 aeb
Packit Service 50ad14
.TH KEYMAPS 5 "24 April 1998"
Packit Service 50ad14
.SH NAME
Packit Service 50ad14
keymaps \- keyboard table descriptions for loadkeys and dumpkeys
Packit Service 50ad14
.SH DESCRIPTION
Packit Service 50ad14
.IX "keymaps" "" "\fLkeymaps\fR \(em keyboard table descriptions for loadkeys and dumpkeys" ""
Packit Service 50ad14
.IX "loadkeys" "keyboard table descriptions" "\fLloadkeys\fR" "keyboard table descriptions"
Packit Service 50ad14
.IX "dumpkeys" "keyboard table descriptions" "\fLdumpkeys\fR" "keyboard table descriptions"
Packit Service 50ad14
.IX keyboard "table descriptions for loadkeys and dumpkeys" keyboard "table descriptions for \fLloadkeys\fR and \fLdumpkeys\fR"
Packit Service 50ad14
.IX "translation tables"
Packit Service 50ad14
.LP
Packit Service 50ad14
These files are used by
Packit Service 50ad14
.BR loadkeys (1)
Packit Service 50ad14
to modify the translation tables used by the kernel keyboard driver
Packit Service 50ad14
and generated by
Packit Service 50ad14
.BR dumpkeys (1)
Packit Service 50ad14
from those translation tables.
Packit Service 50ad14
.LP
Packit Service 50ad14
The format of these files is vaguely similar to the one accepted by
Packit Service 50ad14
.BR xmodmap (1).
Packit Service 50ad14
The file consists of charset or key or string definition lines
Packit Service 50ad14
interspersed with comments.
Packit Service 50ad14
.LP
Packit Service 50ad14
Comments are introduced with
Packit Service 50ad14
.B !
Packit Service 50ad14
or
Packit Service 50ad14
.B #
Packit Service 50ad14
characters and continue to the end of the line. Anything following one
Packit Service 50ad14
of these characters on that line is ignored. Note that comments need
Packit Service 50ad14
not begin from column one as with
Packit Service 50ad14
.BR xmodmap (1).
Packit Service 50ad14
.LP
Packit Service 50ad14
The syntax of keymap files is line oriented; a complete definition
Packit Service 50ad14
must fit on a single logical line. Logical lines can, however, be split
Packit Service 50ad14
into multiple physical lines by ending each subline with the backslash
Packit Service 50ad14
character (\\).
Packit Service 50ad14
.SH "INCLUDE FILES"
Packit Service 50ad14
A keymap can include other keymaps using the syntax
Packit Service 50ad14
.LP
Packit Service 50ad14
.RS
Packit Service 50ad14
include "pathname"
Packit Service 50ad14
.RE
Packit Service 50ad14
.LP
Packit Service 50ad14
.SH "CHARSET DEFINITIONS"
Packit Service 50ad14
A character set definition line is of the form:
Packit Service 50ad14
.LP
Packit Service 50ad14
.RS
Packit Service 50ad14
.EX
Packit Service 50ad14
charset "iso-8859-x"
Packit Service 50ad14
.EE
Packit Service 50ad14
.RE
Packit Service 50ad14
.LP
Packit Service 50ad14
It defines how following keysyms are to be interpreted.
Packit Service 50ad14
For example, in iso-8859-1 the symbol mu (or micro) has code 0265,
Packit Service 50ad14
while in iso-8859-7 the letter mu has code 0354.
Packit Service 50ad14
.SH "COMPLETE KEYCODE DEFINITIONS"
Packit Service 50ad14
Each complete key definition line is of the form:
Packit Service 50ad14
.LP
Packit Service 50ad14
.RS
Packit Service 50ad14
.nf
Packit Service 50ad14
.BI keycode " keynumber " = " keysym keysym keysym" \fR...
Packit Service 50ad14
.fi
Packit Service 50ad14
.RE
Packit Service 50ad14
.LP
Packit Service 50ad14
.I keynumber
Packit Service 50ad14
is the internal identification number of the key, roughly equivalent to
Packit Service 50ad14
the scan code of it.
Packit Service 50ad14
.I keynumber
Packit Service 50ad14
can be given in decimal, octal or hexadecimal notation.
Packit Service 50ad14
Octal is denoted by a leading zero and hexadecimal by the prefix
Packit Service 50ad14
.B 0x.
Packit Service 50ad14
.LP
Packit Service 50ad14
Each of the
Packit Service 50ad14
.I keysyms
Packit Service 50ad14
represent keyboard actions, of which up to 256 can be bound to a single
Packit Service 50ad14
key. The actions available include outputting character codes or
Packit Service 50ad14
character sequences, switching consoles or keymaps, booting the machine
Packit Service 50ad14
etc. (The complete list can be obtained from dumpkeys(1) by saying
Packit Service 50ad14
.BI " dumpkeys -l"
Packit Service 50ad14
\&.)
Packit Service 50ad14
.LP
Packit Service 50ad14
Each
Packit Service 50ad14
.I keysym
Packit Service 50ad14
may be prefixed by a '+' (plus sign), in wich case this keysym is treated
Packit Service 50ad14
as a "letter" and therefore affected by the "CapsLock" the same way as by
Packit Service 50ad14
"Shift" (to be correct, the CapsLock inverts the Shift state).
Packit Service 50ad14
The ASCII letters ('a'-'z' and 'A'-'Z') are made CapsLock'able by default.
Packit Service 50ad14
If Shift+CapsLock should not produce a lower case symbol, put lines like
Packit Service 50ad14
.LP
Packit Service 50ad14
.RS
Packit Service 50ad14
.nf
Packit Service 50ad14
.BI "keycode 30 = +a  A"
Packit Service 50ad14
.fi
Packit Service 50ad14
.RE
Packit Service 50ad14
.LP
Packit Service 50ad14
in the map file.
Packit Service 50ad14
.LP
Packit Service 50ad14
Which of the actions bound to a given key is taken when it is pressed
Packit Service 50ad14
depends on what modifiers are in effect at that moment.
Packit Service 50ad14
The keyboard driver supports 9 modifiers. These modifiers are labeled
Packit Service 50ad14
(completely arbitrarily) Shift, AltGr, Control, Alt, ShiftL, ShiftR,
Packit Service 50ad14
CtrlL, CtrlR and CapsShift.
Packit Service 50ad14
Each of these modifiers has an associated weight of power of two
Packit Service 50ad14
according to the following table:
Packit Service 50ad14
Packit Service 50ad14
.ev table
Packit Service 50ad14
.LP
Packit Service 50ad14
.RS
Packit Service 50ad14
.TP 20
Packit Service 50ad14
.I modifier
Packit Service 50ad14
.I weight
Packit Service 50ad14
.P
Packit Service 50ad14
.ta T 24R
Packit Service 50ad14
Shift	1
Packit Service 50ad14
.br
Packit Service 50ad14
AltGr	2
Packit Service 50ad14
.br
Packit Service 50ad14
Control	4
Packit Service 50ad14
.br
Packit Service 50ad14
Alt	8
Packit Service 50ad14
.br
Packit Service 50ad14
ShiftL	16
Packit Service 50ad14
.br
Packit Service 50ad14
ShiftR	32
Packit Service 50ad14
.br
Packit Service 50ad14
CtrlL	64
Packit Service 50ad14
.br
Packit Service 50ad14
CtrlR	128
Packit Service 50ad14
.br
Packit Service 50ad14
CapsShift	256
Packit Service 50ad14
.RE
Packit Service 50ad14
.LP
Packit Service 50ad14
.ev
Packit Service 50ad14
The effective action of a key is found out by adding up the weights of
Packit Service 50ad14
all the modifiers in effect. By default, no modifiers are in effect, so
Packit Service 50ad14
action number zero, i.e. the one in the first column in a key definition
Packit Service 50ad14
line, is taken when the key is pressed or released. When e.g. Shift and
Packit Service 50ad14
Alt modifiers are in effect, action number nine (from the 10th column)
Packit Service 50ad14
is the effective one.
Packit Service 50ad14
.LP
Packit Service 50ad14
Changing the state of what modifiers are in effect can be achieved by
Packit Service 50ad14
binding appropriate key actions to desired keys. For example, binding
Packit Service 50ad14
the symbol Shift to a key sets the Shift modifier in effect when that
Packit Service 50ad14
key is pressed and cancels the effect of that modifier when the key is
Packit Service 50ad14
released. Binding AltGr_Lock to a key sets AltGr in effect when the key
Packit Service 50ad14
is pressed and cancels the effect when the key is pressed again.
Packit Service 50ad14
(By default Shift, AltGr, Control and Alt are bound to the keys that bear
Packit Service 50ad14
a similar label; AltGr may denote the right Alt key.)
Packit Service 50ad14
.LP
Packit Service 50ad14
Note that you should be very careful when binding the modifier keys,
Packit Service 50ad14
otherwise you can end up with an unusable keyboard mapping. If you for
Packit Service 50ad14
example define a key to have Control in its first column and leave the
Packit Service 50ad14
rest of the columns to be VoidSymbols, you're in trouble. This is
Packit Service 50ad14
because pressing the key puts Control modifier in effect and the
Packit Service 50ad14
following actions are looked up from the fifth column (see the table
Packit Service 50ad14
above). So, when you release the key, the action from the fifth column
Packit Service 50ad14
is taken. It has VoidSymbol in it, so nothing happens. This means that
Packit Service 50ad14
the Control modifier is still in effect, although you have released the key.
Packit Service 50ad14
Re-pressing and releasing the key has no effect. To avoid this,
Packit Service 50ad14
you should always define all the columns to have the same modifier
Packit Service 50ad14
symbol. There is a handy short-hand notation for this, see below.
Packit Service 50ad14
.LP
Packit Service 50ad14
.I keysyms
Packit Service 50ad14
can be given in decimal, octal, hexadecimal, unicode or symbolic notation.
Packit Service 50ad14
The numeric notations use the same format as with
Packit Service 50ad14
.IR keynumber .
Packit Service 50ad14
Unicode notation is "U+" followed by four hexadecimal digits.
Packit Service 50ad14
The symbolic notation resembles that used by
Packit Service 50ad14
.BR xmodmap (1).
Packit Service 50ad14
Notable differences are the number symbols. The numeric
Packit Service 50ad14
symbols '0', ..., '9' of
Packit Service 50ad14
.BR xmodmap (1)
Packit Service 50ad14
are replaced with the corresponding words 'zero', 'one', ... 'nine' to
Packit Service 50ad14
avoid confusion with the numeric notation.
Packit Service 50ad14
.LP
Packit Service 50ad14
It should be noted that using numeric notation for the
Packit Service 50ad14
.I keysyms
Packit Service 50ad14
is highly unportable as the key action numbers may vary from one kernel
Packit Service 50ad14
version to another and the use of numeric notations is thus strongly
Packit Service 50ad14
discouraged. They are intended to be used only when you know there is a
Packit Service 50ad14
supported keyboard action in your kernel for which your current version
Packit Service 50ad14
of
Packit Service 50ad14
.BR loadkeys (1)
Packit Service 50ad14
has no symbolic name.
Packit Service 50ad14
.LP
Packit Service 50ad14
There is a number of short-hand notations to add readability and reduce
Packit Service 50ad14
typing work and the probability of typing-errors.
Packit Service 50ad14
.LP
Packit Service 50ad14
First of all, you can give a map specification line, of the form
Packit Service 50ad14
.LP
Packit Service 50ad14
.RS
Packit Service 50ad14
.EX
Packit Service 50ad14
keymaps 0-2,4-5,8,12
Packit Service 50ad14
.EE
Packit Service 50ad14
.RE
Packit Service 50ad14
.LP
Packit Service 50ad14
to indicate that the lines of the keymap will not specify all 256 columns,
Packit Service 50ad14
but only the indicated ones. (In the example: only the plain, Shift,
Packit Service 50ad14
AltGr, Control, Control+Shift, Alt and Control+Alt maps, that is, 7 columns
Packit Service 50ad14
instead of 256.)
Packit Service 50ad14
When no such line is given, the keymaps 0-M will be defined, where
Packit Service 50ad14
M+1 is the maximum number of entries found in any definition line.
Packit Service 50ad14
.LP
Packit Service 50ad14
Next, you can leave off any trailing VoidSymbol entries from a key
Packit Service 50ad14
definition line. VoidSymbol denotes a keyboard action which produces no
Packit Service 50ad14
output and has no other effects either. For example, to define key
Packit Service 50ad14
number 30 to output 'a' unshifted, 'A' when pressed with Shift and do
Packit Service 50ad14
nothing when pressed with AltGr or other modifiers, you can write
Packit Service 50ad14
.LP
Packit Service 50ad14
.RS
Packit Service 50ad14
.nf
Packit Service 50ad14
keycode  30 = a	A
Packit Service 50ad14
.fi
Packit Service 50ad14
.RE
Packit Service 50ad14
.LP
Packit Service 50ad14
instead of the more verbose
Packit Service 50ad14
.LP
Packit Service 50ad14
.RS
Packit Service 50ad14
.nf
Packit Service 50ad14
keycode  30 = a	A	VoidSymbol	VoidSymbol \\
Packit Service 50ad14
		VoidSymbol VoidSymbol VoidSymbol ...
Packit Service 50ad14
.fi
Packit Service 50ad14
.RE
Packit Service 50ad14
.LP
Packit Service 50ad14
For added convenience, you can usually get off with still more terse
Packit Service 50ad14
definitions. If you enter a key definition line with only and exactly
Packit Service 50ad14
one action code after the equals sign, it has a special meaning. If the
Packit Service 50ad14
code (numeric or symbolic) is not an ASCII letter, it means the code
Packit Service 50ad14
is implicitly replicated through all columns being defined.
Packit Service 50ad14
If, on the other hand, the action code is an ASCII character in the
Packit Service 50ad14
range 'a', ..., 'z' or 'A', ..., 'Z' in the ASCII collating sequence,
Packit Service 50ad14
the following definitions are made for the different modifier combinations,
Packit Service 50ad14
provided these are actually being defined.
Packit Service 50ad14
(The table lists the two possible cases:
Packit Service 50ad14
either the single action code is a lower case letter,
Packit Service 50ad14
denoted by 'x' or an upper case letter, denoted by 'Y'.)
Packit Service 50ad14
.LP
Packit Service 50ad14
.RS 4
Packit Service 50ad14
.TP 24
Packit Service 50ad14
.I modifier
Packit Service 50ad14
.I symbol
Packit Service 50ad14
.TP 24
Packit Service 50ad14
none
Packit Service 50ad14
x			Y
Packit Service 50ad14
.PD 0
Packit Service 50ad14
.TP 24
Packit Service 50ad14
Shift
Packit Service 50ad14
X			y
Packit Service 50ad14
.TP 24
Packit Service 50ad14
AltGr
Packit Service 50ad14
x			Y
Packit Service 50ad14
.TP 24
Packit Service 50ad14
Shift+AltGr
Packit Service 50ad14
X			y
Packit Service 50ad14
.TP 24
Packit Service 50ad14
Control
Packit Service 50ad14
Control_x		Control_y
Packit Service 50ad14
.TP 24
Packit Service 50ad14
Shift+Control
Packit Service 50ad14
Control_x		Control_y
Packit Service 50ad14
.TP 24
Packit Service 50ad14
AltGr+Control
Packit Service 50ad14
Control_x		Control_y
Packit Service 50ad14
.TP 24
Packit Service 50ad14
Shift+AltGr+Control
Packit Service 50ad14
Control_x		Control_y
Packit Service 50ad14
.TP 24
Packit Service 50ad14
Alt
Packit Service 50ad14
Meta_x		Meta_Y
Packit Service 50ad14
.TP 24
Packit Service 50ad14
Shift+Alt
Packit Service 50ad14
Meta_X		Meta_y
Packit Service 50ad14
.TP 24
Packit Service 50ad14
AltGr+Alt
Packit Service 50ad14
Meta_x		Meta_Y
Packit Service 50ad14
.TP 24
Packit Service 50ad14
Shift+AltGr+Alt
Packit Service 50ad14
Meta_X		Meta_y
Packit Service 50ad14
.TP 24
Packit Service 50ad14
Control+Alt
Packit Service 50ad14
Meta_Control_x	Meta_Control_y
Packit Service 50ad14
.TP 24
Packit Service 50ad14
Shift+Control+Alt
Packit Service 50ad14
Meta_Control_x	Meta_Control_y
Packit Service 50ad14
.TP 24
Packit Service 50ad14
AltGr+Control+Alt
Packit Service 50ad14
Meta_Control_x	Meta_Control_y
Packit Service 50ad14
.TP 24
Packit Service 50ad14
Shift+AltGr+Control+Alt
Packit Service 50ad14
Meta_Control_x	Meta_Control_y
Packit Service 50ad14
.PD
Packit Service 50ad14
.RE
Packit Service 50ad14
.LP
Packit Service 50ad14
.SH "SINGLE MODIFIER DEFINITIONS"
Packit Service 50ad14
All the previous forms of key definition lines always define all the M+1
Packit Service 50ad14
possible modifier combinations being defined, whether the line actually
Packit Service 50ad14
contains that many action codes or not.
Packit Service 50ad14
There is, however, a variation of the definition
Packit Service 50ad14
syntax for defining only single actions to a particular modifier
Packit Service 50ad14
combination of a key. This is especially useful, if you load a keymap
Packit Service 50ad14
which doesn't match your needs in only some modifier combinations, like
Packit Service 50ad14
AltGr+function keys. You can then make a small local file redefining
Packit Service 50ad14
only those modifier combinations and loading it after the main file.
Packit Service 50ad14
The syntax of this form is:
Packit Service 50ad14
.LP
Packit Service 50ad14
.BR "" { " plain " "| <modifier sequence> } " keycode
Packit Service 50ad14
.I keynumber
Packit Service 50ad14
.B =
Packit Service 50ad14
.I keysym
Packit Service 50ad14
.LP
Packit Service 50ad14
, e.g.,
Packit Service 50ad14
.RS
Packit Service 50ad14
.EX
Packit Service 50ad14
.nf
Packit Service 50ad14
plain keycode 14 = BackSpace
Packit Service 50ad14
control alt keycode 83 = Boot
Packit Service 50ad14
alt keycode 105 = Decr_Console
Packit Service 50ad14
alt keycode 106 = Incr_Console
Packit Service 50ad14
.fi
Packit Service 50ad14
.EE
Packit Service 50ad14
.RE
Packit Service 50ad14
Using "plain" will define only the base entry of a
Packit Service 50ad14
key (i.e. the one with no modifiers in effect) without affecting the
Packit Service 50ad14
bindings of other modifier combinations of that key.
Packit Service 50ad14
.SH "STRING DEFINITIONS"
Packit Service 50ad14
In addition to comments and key definition lines, a keymap can
Packit Service 50ad14
contain string definitions. These are used to define what each function
Packit Service 50ad14
key action code sends. The syntax of string definitions is:
Packit Service 50ad14
.LP
Packit Service 50ad14
.RS
Packit Service 50ad14
.B string
Packit Service 50ad14
.I keysym
Packit Service 50ad14
.B =
Packit Service 50ad14
.BI
Packit Service 50ad14
"text"
Packit Service 50ad14
.RE
Packit Service 50ad14
.LP
Packit Service 50ad14
.I text
Packit Service 50ad14
can contain literal characters, octal character codes in the format of
Packit Service 50ad14
backslash followed by up to three octal digits, and the three escape
Packit Service 50ad14
sequences \fB\\n\fP, \fB\\\\\fP, and \fB\\"\fP,
Packit Service 50ad14
for newline, backslash and quote, respectively.
Packit Service 50ad14
.SH "COMPOSE DEFINITIONS"
Packit Service 50ad14
Then there may also be compose definitions. They have syntax
Packit Service 50ad14
.LP
Packit Service 50ad14
.RS
Packit Service 50ad14
.BI "compose '" char "' '" char "' to '" char "'"
Packit Service 50ad14
.RE
Packit Service 50ad14
and describe how two bytes are combined to form a third one
Packit Service 50ad14
(when a dead accent or compose key is used).
Packit Service 50ad14
This is used to get accented letters and the like on a standard
Packit Service 50ad14
keyboard.
Packit Service 50ad14
.SH ABBREVIATIONS
Packit Service 50ad14
Various abbreviations can be used with kbd-0.96 and later.
Packit Service 50ad14
.TP
Packit Service 50ad14
.B "strings as usual"
Packit Service 50ad14
Defines the usual values of the strings (but not the keys
Packit Service 50ad14
they are bound to).
Packit Service 50ad14
.TP
Packit Service 50ad14
\fBcompose as usual for "iso-8859-1"\fP
Packit Service 50ad14
Defines the usual compose combinations.
Packit Service 50ad14
.LP
Packit Service 50ad14
To find out what
Packit Service 50ad14
.I keysyms
Packit Service 50ad14
there are available for use in keymaps, use the command
Packit Service 50ad14
.LP
Packit Service 50ad14
.RS
Packit Service 50ad14
.nf
Packit Service 50ad14
.B dumpkeys --long-info
Packit Service 50ad14
.fi
Packit Service 50ad14
.RE
Packit Service 50ad14
.LP
Packit Service 50ad14
Unfortunately, there is currently no description of what each symbol
Packit Service 50ad14
does. It has to be guessed from the name or figured out from the kernel
Packit Service 50ad14
sources.
Packit Service 50ad14
.LP
Packit Service 50ad14
.SH EXAMPLES
Packit Service 50ad14
(Be careful to use a keymaps line, like the first line of `dumpkeys`,
Packit Service 50ad14
or "keymaps 0-15" or so.)
Packit Service 50ad14
.LP
Packit Service 50ad14
The following entry exchanges the left Control key and the Caps Lock
Packit Service 50ad14
key on the keyboard:
Packit Service 50ad14
.LP
Packit Service 50ad14
.RS
Packit Service 50ad14
.nf
Packit Service 50ad14
keycode  58 = Control
Packit Service 50ad14
keycode  29 = Caps_Lock
Packit Service 50ad14
.fi
Packit Service 50ad14
.RE
Packit Service 50ad14
.LP
Packit Service 50ad14
Key number 58 is normally the Caps Lock key, and key number 29 is
Packit Service 50ad14
normally the Control key.
Packit Service 50ad14
.LP
Packit Service 50ad14
The following entry sets the Shift and Caps Lock keys to behave more
Packit Service 50ad14
nicely, like in older typewriters. That is, pressing Caps Lock key once
Packit Service 50ad14
or more sets the keyboard in CapsLock state and pressing either of the
Packit Service 50ad14
Shift keys releases it.
Packit Service 50ad14
.LP
Packit Service 50ad14
.RS
Packit Service 50ad14
.nf
Packit Service 50ad14
keycode  42 = Uncaps_Shift
Packit Service 50ad14
keycode  54 = Uncaps_Shift
Packit Service 50ad14
keycode  58 = Caps_On
Packit Service 50ad14
.fi
Packit Service 50ad14
.RE
Packit Service 50ad14
.LP
Packit Service 50ad14
The following entry sets the layout of the edit pad in the enhanced
Packit Service 50ad14
keyboard to be more like that in the VT200 series terminals:
Packit Service 50ad14
.LP
Packit Service 50ad14
.RS
Packit Service 50ad14
.nf
Packit Service 50ad14
keycode 102 = Insert
Packit Service 50ad14
keycode 104 = Remove
Packit Service 50ad14
keycode 107 = Prior
Packit Service 50ad14
shift keycode 107 = Scroll_Backward
Packit Service 50ad14
keycode 110 = Find
Packit Service 50ad14
keycode 111 = Select
Packit Service 50ad14
control alt   keycode 111 = Boot
Packit Service 50ad14
control altgr keycode 111 = Boot
Packit Service 50ad14
.fi
Packit Service 50ad14
.RE
Packit Service 50ad14
.LP
Packit Service 50ad14
Here's an example to bind the string "du\\ndf\\n" to the key AltGr-D. We use
Packit Service 50ad14
the "spare" action code F100 not normally bound to any key.
Packit Service 50ad14
.LP
Packit Service 50ad14
.RS
Packit Service 50ad14
.nf
Packit Service 50ad14
altgr keycode 32 = F100
Packit Service 50ad14
string F100 = "du\\ndf\\n"
Packit Service 50ad14
.LP
Packit Service 50ad14
.SH "SEE ALSO"
Packit Service 50ad14
.BR loadkeys (1),
Packit Service 50ad14
.BR dumpkeys (1),
Packit Service 50ad14
.BR showkey (1),
Packit Service 50ad14
.BR xmodmap (1)