Keyboard definitions: Difference between revisions
(New article) |
(Very basic instructions) |
||
Line 1: | Line 1: | ||
See also [[Input methods]] for writing systems that cannot be typed in a standard xkb [[Keyboard Layouts|keyboard layout]], such as [[Chinese]] Hanzi, [[Japanese]] Kanji, [[Korean]] Hanja and Hangeul, Ethiopic, and others. |
|||
⚫ | |||
The X keyboard files may be found in /etc/X11/xkb/symbols/, or /usr/share/X11/xkb/symbols/, depending on your Linux distribution. Most of the keyboard file names are two-letter language codes, or are based on those codes. |
|||
KDE and other desktop managers have keyboard switching applets. The kxkb applet places an icon in the toolbar allowing you to select from the keyboards you have configured, or to configure others. You can also access it from the KDE Control Center on the main menu, in order to turn on the toolbar icon, if you don't like setting it up from the command line. |
|||
(Instructions for Gnome gnome-keyboard-applet and others, please.) |
|||
To add a keyboard layout, select a keyboard file similar to what you need, if possible, and copy it to a working directory. Edit the tables and the description, and save with the name you want to use, preferably the language code, or using the form language_version, such as en_US (US English) or fr_CH (Swiss French). As root, place your new keyboard file in the appropriate directory. Add your file name and language name to the keyboard list file /etc/X11/xkb/rules/xfree86.lst or /etc/X11/xkb/rules/xorg.lst, depending whether you are using a version of X from XFree86 or one from X.org. |
|||
When your keyboard layout is working to your satisfaction, post it here and on an appropriate I18n development mailing list. When we are all happy with it, it will go into a distribution, and into the pool from which all other distributions draw. |
|||
⚫ | |||
<pre> |
<pre> |
||
Line 46: | Line 58: | ||
If you need to load a non-latin layout; load also a latin one; otherwise |
If you need to load a non-latin layout; load also a latin one; otherwise |
||
you are in big trouble :-) (unless you have some other way to change |
you are in big trouble :-) (unless you have some other way to change |
||
keyboards, such as a toolbar menu.) |
|||
For example: setxkbmap "fr,tifinagh(extended)" -option "grp:shifts_toggle" |
For example: setxkbmap "fr,tifinagh(extended)" -option "grp:shifts_toggle" |
Revision as of 06:33, 3 November 2006
See also Input methods for writing systems that cannot be typed in a standard xkb keyboard layout, such as Chinese Hanzi, Japanese Kanji, Korean Hanja and Hangeul, Ethiopic, and others.
The X keyboard files may be found in /etc/X11/xkb/symbols/, or /usr/share/X11/xkb/symbols/, depending on your Linux distribution. Most of the keyboard file names are two-letter language codes, or are based on those codes.
KDE and other desktop managers have keyboard switching applets. The kxkb applet places an icon in the toolbar allowing you to select from the keyboards you have configured, or to configure others. You can also access it from the KDE Control Center on the main menu, in order to turn on the toolbar icon, if you don't like setting it up from the command line.
(Instructions for Gnome gnome-keyboard-applet and others, please.)
To add a keyboard layout, select a keyboard file similar to what you need, if possible, and copy it to a working directory. Edit the tables and the description, and save with the name you want to use, preferably the language code, or using the form language_version, such as en_US (US English) or fr_CH (Swiss French). As root, place your new keyboard file in the appropriate directory. Add your file name and language name to the keyboard list file /etc/X11/xkb/rules/xfree86.lst or /etc/X11/xkb/rules/xorg.lst, depending whether you are using a version of X from XFree86 or one from X.org.
When your keyboard layout is working to your satisfaction, post it here and on an appropriate I18n development mailing list. When we are all happy with it, it will go into a distribution, and into the pool from which all other distributions draw.
Notes provided by Pablo Saratxaga of Mandriva Linux. Rewriting needed.
The X11 keyboard layouts are simple text files; in each file there may be one or more layouts defined. A layout can include some other one instead of redefining common things. It has a name: name[Group1]="Foo"; that is used by some keyboard selection tools. Then, it defines the needed keys. For unicode keysyms, you have to add 0x1000000 to the unicode value. For characters that can be defined with the literal keysyms (all those in ascii and iso-8859-*) it is better to use them (eg, "space" instead of "0x1000020"). individual keys are defined like this: key <CODE> { [ normal, shift, altgr, altgr_shift ] }; the CODE for a key is Axyy with x a letter to identify the row it is in: E: the row with the digits D: top row of letters C: middle row B: bottom row A: the row of space bar and yy is a number (in decimal notation) identifying the column: 01, 02, 03, 04, ...., 09, 10, 11, ... some keys have special codes: LSGT, TLDE, BKSL, as they change their position depending on the keyboard models. and then all the special keys (space, control, function keys, numeric keypad, etc) have special names too (but most often you don't need to redefine them) the best is to just take an existing layout file, and edit it to match what you need. To test it without restarting X, just launch: setxkbmap "xx" or: setxkbmap "xx(yy)" the first will load the default layout on the file "xx", the second will load the layout "yy" of the file "xx". If you need to load a non-latin layout; load also a latin one; otherwise you are in big trouble :-) (unless you have some other way to change keyboards, such as a toolbar menu.) For example: setxkbmap "fr,tifinagh(extended)" -option "grp:shifts_toggle" loads both the French (fr) and tifinagh(extended) layouts; and defines pressing both shift keys to toggle between those layouts. It is possible to cheat a bit, by sending an unused unicode value, and having the Compose file redefine that to the wanted string. I have done it for arabic and tifinagh layouts; it works quite well.
It is not difficult to learn the file format by reading files in /etc/X11/xkb, including the various READMEs, but it is easier if you refer to the complete specification can be found at http://www.x-docs.org/XKB/XKBproto.pdf
A keyboard file usually has a two-letter name, from the IANA Language Subtag Registry, which replaces the obsolete ISO 639 standard for language codes.
When you are satisfied with a keyboard file, you can copy it to /etc/X11/xkb/symbols, where programs like KDE Control Center will pick it up automatically the next time you start X. (Look under Regional & Accessibility for Keyboard Layouts.) You can put any selection of keyboards on a toolbar menu.
We need somebody to comb through the keyboards available in the various Linux distributions, starting with Mandriva, and add them to the Laptop distribution. Anybody? I'll help.--Mokurai 00:00, 13 October 2006 (EDT)