MAN page from RedHat Other kbd-0.91-10.i386.rpm
KEYTABLES
Section: File Formats (5)
Updated: 30 Jan 1994
Index NAME
keytables - keyboard table descriptions for loadkeys and dumpkeys
DESCRIPTION
These files are used byloadkeys(1)to modify the translation tables used by the keyboard driverand generated bydumpkeys(1)from those translation tables.
The format of these files is vaguely similar to the one accepted byxmodmap(1).The file consists of charset or key or string definition linesinterspersed with comments.
Comments are introduced with!or#characters and continue to the end of the line. Anything following oneof these characters on that line is ignored. Note that comments neednot begin from column one as withxmodmap(1).
The syntax of keytable files is line oriented; a complete definitionmust fit on a single logical line. Logical lines can, however, be splitinto multiple physical lines by ending each subline with the backslashcharacter (\).
A character set definition line is of the form:
- charset "iso-8859-x"
It defines how following keysyms are to be interpreted.
Each complete key definition line is of the form:
keycode keynumber = keysym keysym keysym...
keynumberis the internal identification number of the key, roughly equivalent tothe scan code of it.keynumbercan be given in decimal, octal or hexadecimal notation.Octal is denoted by a leading zero and hexadecimal by the prefix0x.
Each of thekeysymsrepresent keyboard actions, of which up to 256 can be bound to a singlekey. The actions available contain outputing Latin1 character codes orcharacter sequences, switching consoles or keymaps, booting the machineetc. (The complete list can be obtained from dumpkeys(1) by saying dumpkeys -l.)
Eachkeysymmay be prefixed by a '+' (plus sign), in wich case this keysym is treatedas a "letter" and therefore affected by the "CapsLock" the same way as by"Shift" (to be correct, the CapsLock inverts the Shift state).The ASCII letters ('a'-'z' and 'A'-'Z') are made CapsLock'able by default.If Shift+CapsLock should not produce a lower case symbol, put lines like
keycode 30 = +a A
in the map file.
Which of the actions bound to a given key is taken when it is presseddepends on what modifiers are in effect at that moment.The keyboard driver supports 8 modifiers. These modifiers are labeled(completely arbitrarily) Shift, AltGr, Control, Alt, ShiftL, ShiftR,CtrlL and CtrlR.Each of these modifiers has an associated weight of power of twoaccording to the following table:
- modifier
- weight
- Shift
1- AltGr
2- Control
4- Alt
8- ShiftL
16- ShiftR
32- CtrlL
64- CtrlR
- 128
The effective action of a key is found out by adding up the weights ofall the modifiers in effect. By default, no modifiers are in effect, soaction number zero, i.e. the one in the first column in a key definitionline, is taken when the key is pressed or released. When e.g. Shift andAlt modifiers are in effect, action number nine (from the 10th column)is the effective one.
Changing the state of what modifiers are in effect can be achieved bybinding appropriate key actions to desired keys. For example, bindingthe symbol Shift to a key sets the Shift modifier in effect when thatkey is pressed and cancels the effect of that modifier when the key isreleased. Binding AltGr_Lock to a key sets AltGr in effect when the keyis pressed and cancels the effect when the key is pressed again.(By default Shift, AltGr, Control and Alt are bound to the keys that beara similar label; AltGr may denote the right Alt key.)
Note that you should be very careful when binding the modifier keys,otherwise you can end up with an unusable keyboard mapping. If you forexample define a key to have Control in its first column and leave therest of the columns to be VoidSymbols, you're in trouble. This isbecause pressing the key puts Control modifier in effect and thefollowing actions are looked up from the fifth column (see the tableabove). So, when you release the key, the action from the fifth columnis taken. It has VoidSymbol in it, so nothing happens. This means thatthe Control modifier is still in effect, although you have released the key.Re-pressing and releasing the key has no effect. To avoid this,you should always define all the columns to have the same modifiersymbol. There is a handy short-hand notation for this, see below.
keysymscan be given in decimal, octal, hexadecimal or symbolic notation.The numeric notations use the same format as withkeynumber.The symbolic notation resembles that used byxmodmap(1).Notable differences are the number symbols. The numericsymbols '0', ..., '9' ofxmodmap(1)are replaced with the corresponding words 'zero', 'one', ... 'nine' toavoid confusion with the numeric notation.
It should be noted that using numeric notation for thekeysymsis highly unportable as the key action numbers may vary from one kernelversion to another and the use of numeric notations is thus stronglydiscouraged. They are intended to be used only when you know there is asupported keyboard action in your kernel for which your current versionofloadkeys(1)has no symbolic name.
There is a number of short-hand notations to add readability and reducetyping work and the probability of typing-errors.
First of all, you can give a map specification line, of the form
- keymaps 0-2,4-5,8,12
to indicate that the lines of the keymap will not specify all 256 columns,but only the indicated ones. (In the example: only the plain, Shift,AltGr, Control, Control+Shift, Alt and Control+Alt maps, that is, 7 columnsinstead of 256.)When no such line is given, the keymaps 0-M will be defined, whereM+1 is the maximum number of entries found in any definition line.
Next, you can leave off any trailing VoidSymbol entries from a keydefinition line. VoidSymbol denotes a keyboard action which produces nooutput and has no other effects either. For example, to define keynumber 30 to output 'a' unshifted, 'A' when pressed with Shift and donothing when pressed with AltGr or other modifiers, you can write
keycode 30 = a A
instead of the more verbose
keycode 30 = a A VoidSymbol VoidSymbol \ VoidSymbol VoidSymbol VoidSymbol ...
For added convenience, you can usually get off with still more tersedefinitions. If you enter a key definition line with only and exactlyone action code after the equals sign, it has a special meaning. If thecode (numeric or symbolic) is not an ASCII letter, it means the codeis implicitly replicated through all columns being defined.If, on the other hand, the action code is an ASCII character in therange 'a', ..., 'z' or 'A', ..., 'Z' in the ASCII collating sequence,the following definitions are made for the different modifier combinations,provided these are actually being defined.(The table lists the two possible cases:either the single action code is a lower case letter,denoted by 'x' or an upper case letter, denoted by 'Y'.)
- modifier
- symbol
- none
- x Y
- Shift
- X y
- AltGr
- x Y
- Shift+AltGr
- X y
- Control
- Control_x Control_y
- Shift+Control
- Control_x Control_y
- AltGr+Control
- Control_x Control_y
- Shift+AltGr+Control
- Control_x Control_y
- Alt
- Meta_x Meta_Y
- Shift+Alt
- Meta_X Meta_y
- AltGr+Alt
- Meta_x Meta_Y
- Shift+AltGr+Alt
- Meta_X Meta_y
- Control+Alt
- Meta_Control_x Meta_Control_y
- Shift+Control+Alt
- Meta_Control_x Meta_Control_y
- AltGr+Control+Alt
- Meta_Control_x Meta_Control_y
- Shift+AltGr+Control+Alt
- Meta_Control_x Meta_Control_y
All the previous forms of key definition lines always define all the M+1possible modifier combinations being defined, whether the line actuallycontains that many action codes or not.There is, however, a variation of the definitionsyntax for defining only single actions to a particular modifiercombination of a key. This is especially useful, if you load a keytablewhich doesn't match your needs in only some modifier combinations, likeAltGr+function keys. You can then make a small local file redefiningonly those modifier combinations and loading it after the main file.The syntax of this form is:
{ plain | <modifier sequence> } keycodekeynumber=keysym
, e.g.,
plain keycode 14 = BackSpacecontrol alt keycode 83 = Bootalt keycode 105 = Decr_Consolealt keycode 106 = Incr_Console
Using "plain" will define only the base entry of akey (i.e. the one with no modifiers in effect) without affecting thebindings of other modifier combinations of that key.
In addition to comments and key definition lines, the keytable files cancontain string definitions. These are used to define what each functionkey action code sends. The syntax of string definitions is:
- stringkeysym="text"
textcan contain literal characters, octal character codes in the format ofbackslash followed by up to three octal digits, and the three escapesequences \n, \\, and \",for newline, backslash and quote, respectively.
To find out whatkeysymsthere are available for use in keytables files, use the command
dumpkeys --long-info
Unfortunately, there is currently no description of what each symboldoes. It has to be guessed from the name or figured out from the kernelsources.
EXAMPLES
The following entry exchanges the left Control key and the Caps Lockkey on the keyboard:
keycode 58 = Controlkeycode 29 = Caps_Lock
Key number 58 is normally the Caps Lock key, and key number 29 isnormally the Control key.
The following entry sets the Shift and Caps Lock keys to behave morenicely, like in older typewriters. That is, pressing Caps Lock key onceor more sets the keyboard in CapsLock state and pressing either of theShift keys releases it.
keycode 42 = Uncaps_Shiftkeycode 54 = Uncaps_Shiftkeycode 58 = Caps_On
The following entry sets the layout of the edit pad in the enhancedkeyboard to be more like that in the VT200 series terminals:
keycode 102 = Insertkeycode 104 = Removekeycode 107 = Priorshift keycode 107 = Scroll_Backwardkeycode 110 = Findkeycode 111 = Selectcontrol alt keycode 111 = Bootcontrol altgr keycode 111 = Boot
Here's an example to bind the string "du\ndf\n" to the key AltGr-D. We usethe "spare" action code F100 not normally bound to any key.
altgr keycode 32 = F100string F100 = "du\ndf\n"
SEE ALSO
loadkeys(1),
dumpkeys(1),
showkey(1),
xmodmap(1)
Index
- NAME
- DESCRIPTION
- EXAMPLES
- SEE ALSO
This document was created byman2html,using the manual pages.