IceWalkers.com - Linux Software downloads and news
Name : Password :
Linux SoftwareLinux RPMLinux HowtosLink UsAboutAdvertise

The Linux keyboard and console HOWTO

Search Howtos :Match :
Next Previous Contents

13. X

This FAQ/HOWTO is about the Linux keyboard and console, not about X, which substitutes its own handling. However, it seems useful to document some of the Linux keyboard and console related properties of X.

First of all, when X is started (say using startx or xinit) it opens the first unused console, unless the desired console has been indicated explicitly, as in xinit -- vt12. Note that this will fail when there is no device file /dev/tty12, but that it will not fail when the indicated console was in use already. When X finishes, it will return to the original console. While it is running one can use Ctrl-Alt-Fn to switch to VTn.

The XFree86 keymap mechanism is much poorer than the Linux mechanism. For each keycode there are at most 4 symbols defined, namely for the 4 keymaps plain, shift, mod, mod+shift. What is the modifier mod? It is the one designated by the symbol Mode_switch. For example, the command xmodmap keys.dk, where the file keys.dk contains

keycode 64 = Mode_switch
keycode 113 = Mode_switch
keycode 38 = a A aring Aring
keycode 26 = e E ae AE
keycode 32 = o O oslash Ooblique
will make both Alt keys into mod keys, so that Alt+a gives å (a-ring), etc. (Note the illogical naming of oslash and Ooblique.) Such an xmodmap command can be placed in the .xinitrc shell script that is executed by default when X is started.

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

Since version 2.1, XFree86 will initialize its keymap from the Linux keymap, as far as possible. However, Linux had 16 entries per key (one for each combination of the Shift, AltGr, Ctrl, Alt modifiers) and presently has 256 entries per key, while X has 4 entries per key (one for each combination of Shift, Mod), so some information is necessarily lost.

First X reads the Xconfig file, where definitions of the LeftAlt, RightAlt, RightCtl, ScrollLock keys as Meta, ModeShift, Compose, ModeLock or ScrollLock might be found - see X386keybd(1), later XFree86kbd(1).

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

Now the kernel keymap is read and the usually obvious corresponding X bindings are made. The bindings for the "action keys" Show_Memory, Show_State, Show_Registers, Last_Console, Console_n, Scroll_Backward, Scroll_Forward, Caps_On and Boot are ignored, as are the dead diacriticals, and the locks (except for ShiftLock), and the "ASCII-x" keys.

Next, the definitions in the Xconfig file are used. (Thus, a definition of Compose in Xconfig will override its value as found in the Linux keymap.)

What happens to the strings associated with the function keys? Nothing, X does not have such a concept. (But it is possible to define strings for function keys in xterm - note however that the window manager gets the keys first.)

I don't know how to convince xterm that it should use the X keymap when Alt is pressed; it seems just to look at its resource eightBitInput, and depending on whether that is true or false either set the high order bit of the character, or generate an additional Escape character (just like setmetamode(1) does for the console).


Next Previous Contents
Search Howtos :Match :
My Money 2.0.49
Personal financial software
Linux Kernel 2.6 2.6.32-rc8
Linux Kernel
GCstar 1.5.0
Personal collections manager
ImageMagick 6.5.7.9
ImageMagick image processing studio
BibleTime 2.4
Bible study software for Linux / KDE
PHP 5.3.1
Server-side, cross-platform, HTML embedded scripting language.
LFTP 4.0.4
Shell-like command line ftp client.
Tellico 2.1.1
Collection manager for books, music, videos, and bibliographies
Totem 2.28.4
Movie player for Gnome
GNOME 2.29.2
GNOME desktop environment
Free IT Magazines, White Papers, eBooks, and more !
Oracle Magazine

Contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more.

Vulnerability Management for Dummies

Get all the Facts and See How to Implement a Successful Vulnerability Management Program.

Website Magazine

Has tapped premier talent in the Internet industry for our content and each and every issue will contain practical advice and insights for website owners.

Linux Software Map
Find Linux RPM
Best Rated Linux Software
Most Rated Linux Software
Linux Distributions
Linux Howtos
Quick Survey

Please take our survey and help us improve our website to serve you better.

Thank you.
Linux Software
Linux / IT Resources
Site Resources
Google
Privacy Policy
Contact Us
Submit Software
Advertising info