Blame docs/doc/kbd.FAQ-13.html

Packit Service 50ad14
Packit Service 50ad14
<HTML>
Packit Service 50ad14
<HEAD>
Packit Service 50ad14
 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
Packit Service 50ad14
 <TITLE>The Linux keyboard and console HOWTO: X</TITLE>
Packit Service 50ad14
 <LINK HREF="kbd.FAQ-14.html" REL=next>
Packit Service 50ad14
 <LINK HREF="kbd.FAQ-12.html" REL=previous>
Packit Service 50ad14
 <LINK HREF="kbd.FAQ.html#toc13" REL=contents>
Packit Service 50ad14
</HEAD>
Packit Service 50ad14
<BODY>
Packit Service 50ad14
Next
Packit Service 50ad14
Previous
Packit Service 50ad14
Contents
Packit Service 50ad14

Packit Service 50ad14

13. X

Packit Service 50ad14
Packit Service 50ad14

Packit Service 50ad14

This FAQ/HOWTO is about the Linux keyboard and console, not about X,

Packit Service 50ad14
which substitutes its own handling. However, it seems useful to
Packit Service 50ad14
document some of the Linux keyboard and console related properties
Packit Service 50ad14
of X.
Packit Service 50ad14

First of all, when X is started (say using startx or xinit)

Packit Service 50ad14
it opens the first unused console, unless the desired console has been
Packit Service 50ad14
indicated explicitly, as in xinit -- vt12.
Packit Service 50ad14
Note that this will fail when there is no device file /dev/tty12,
Packit Service 50ad14
but that it will not fail when the indicated console was in use already.
Packit Service 50ad14
When X finishes, it will return to the original console.
Packit Service 50ad14
While it is running one can use Ctrl-Alt-Fn to switch to VTn.
Packit Service 50ad14

The XFree86 keymap mechanism is much poorer than the Linux mechanism.

Packit Service 50ad14
For each keycode there are at most 4 symbols defined, namely for the
Packit Service 50ad14
4 keymaps plain, shift, mod, mod+shift. What is the modifier mod?
Packit Service 50ad14
It is the one designated by the symbol Mode_switch.
Packit Service 50ad14
For example, the command xmodmap keys.dk, where the file
Packit Service 50ad14
keys.dk contains
Packit Service 50ad14
Packit Service 50ad14
Packit Service 50ad14
keycode 64 = Mode_switch
Packit Service 50ad14
keycode 113 = Mode_switch
Packit Service 50ad14
keycode 38 = a A aring Aring
Packit Service 50ad14
keycode 26 = e E ae AE
Packit Service 50ad14
keycode 32 = o O oslash Ooblique
Packit Service 50ad14
Packit Service 50ad14
Packit Service 50ad14
Packit Service 50ad14
will make both Alt keys into mod keys, so that Alt+a gives å (a-ring), etc.
Packit Service 50ad14
(Note the illogical naming of oslash and Ooblique.)
Packit Service 50ad14
Such an xmodmap command can be placed in the .xinitrc
Packit Service 50ad14
shell script that is executed by default when X is started.
Packit Service 50ad14

Packit Service 50ad14

13.1 What precisely does XFree86-2.1 do when it initializes its keymap?

Packit Service 50ad14
Packit Service 50ad14
Packit Service 50ad14

Packit Service 50ad14
Packit Service 50ad14
keymap!initialization by XFree86
Packit Service 50ad14
-->
Packit Service 50ad14
Packit Service 50ad14
Packit Service 50ad14
XFree86!keymap initialization
Packit Service 50ad14
-->
Packit Service 50ad14

Since version 2.1, XFree86 will initialize its keymap from the Linux keymap,

Packit Service 50ad14
as far as possible. However, Linux had 16 entries per key (one for each
Packit Service 50ad14
combination of the Shift, AltGr, Ctrl, Alt modifiers) and presently has
Packit Service 50ad14
256 entries per key, while X has 4 entries per key (one for each combination
Packit Service 50ad14
of Shift, Mod), so some information is necessarily lost.
Packit Service 50ad14

First X reads the Xconfig file, where definitions of the LeftAlt, RightAlt,

Packit Service 50ad14
RightCtl, ScrollLock keys as Meta, ModeShift, Compose, ModeLock or ScrollLock
Packit Service 50ad14
might be found - see X386keybd(1), later XFree86kbd(1).
Packit Service 50ad14

For Mod the LeftAlt key is taken, unless RightCtl was defined as ModeShift or

Packit Service 50ad14
ModeLock, in which case RightCtl is taken, or RightAlt was so defined, in which
Packit Service 50ad14
case RightAlt is taken.
Packit Service 50ad14
This determines how the 4 XFree86 meanings of a key are selected from the 16
Packit Service 50ad14
Linux meanings.
Packit Service 50ad14
Note that Linux today does not distinguish by default between the two Ctrl keys
Packit Service 50ad14
or between the two Shift keys. X does distinguish.
Packit Service 50ad14

Now the kernel keymap is read and the usually obvious corresponding X

Packit Service 50ad14
bindings are made. The bindings for the "action keys" Show_Memory, Show_State,
Packit Service 50ad14
Show_Registers, Last_Console, Console_n, Scroll_Backward, Scroll_Forward,
Packit Service 50ad14
Caps_On and Boot are ignored, as are the dead diacriticals, and the locks
Packit Service 50ad14
(except for ShiftLock), and the "ASCII-x" keys.
Packit Service 50ad14

Next, the definitions in the Xconfig file are used. (Thus, a definition

Packit Service 50ad14
of Compose in Xconfig will override its value as found in the Linux
Packit Service 50ad14
keymap.)
Packit Service 50ad14

What happens to the strings associated with the function keys? Nothing,

Packit Service 50ad14
X does not have such a concept. (But it is possible to define strings
Packit Service 50ad14
for function keys in xterm - note however that the window manager gets the
Packit Service 50ad14
keys first.)
Packit Service 50ad14

I don't know how to convince xterm that it should use the X keymap

Packit Service 50ad14
when Alt is pressed; it seems just to look at its resource eightBitInput,
Packit Service 50ad14
and depending on whether that is true or false either set the high order bit
Packit Service 50ad14
of the character, or generate an additional Escape character
Packit Service 50ad14
(just like setmetamode(1) does for the console).
Packit Service 50ad14

Packit Service 50ad14

Packit Service 50ad14
Next
Packit Service 50ad14
Previous
Packit Service 50ad14
Contents
Packit Service 50ad14
</BODY>
Packit Service 50ad14
</HTML>