Russian Keyboard support in XFree86 |
|||
|
While there are dozens of pages out there giving instructions on how to set up Russian keyboard support in Linux, the majority of them are either in Russian or describe a hacky work-around that just sort of makes it work without fixing the problem properly. With a little bit of research, I came up with the following method of entering Russian text. From here on out, I'm going to assume that you have at least one cyrillic font installed and that you have convinced any programs in which you wish to use Russian input to use that font. It turns out that XFree86 comes with all of the necessary "stuff" to switch keyboard layouts and change input modes on the fly in the form of xkb. It becomes simply a matter of letting xkb know what you want from it to get cyrillic input working. As of XFree86 4.x, the xkb extension is configured on a per-input-device basis. You should have one or more input device stanzas in your XFree86Config (which you will have to find yourself, as different distributions put it in different places; on my RedHat 7.1 and YellowDog 2.0 boxes it is /etc/X11/XFree86Config-4) that look something like this:
Section "InputDevice"
Identifier "Keyboard0"
Driver "keyboard"
Option "XkbLayout" "us"
Option "XkbOptions" "ctrl:nocaps"
EndSection
There may or may not be comments or other lines in the section, but that should be sufficient for you to identify it; my YellowDog box has about three times as many lines in its input section owing to the fact that it has to bind all the crazy Mac keys and stuff. Also, you may or may not have an "XkbOptions" line. I have it to get rid of that useless Caps Lock key and make it into something useful. The first thing you'll notice is that X thinks we have a US keyboard layout; while (if you are like me) this is probably technically correct, you'll need to tell xkb otherwise if you want cyrillic input. The other key step is to tell it how you want to switch your input style; obviously you don't want to lose latin input support when you enable Russian input. The way xkb handles this is to use a particular keystroke to change between mappings; the "default" keystroke is Shift+Shift ... Hold down left shift and press right shift. At any rate, by modifying that input device description, we can let xkb know what we want. In XFree86 4.0.x through 4.2.x, you change your keyboard layout to simply "ru", and in 4.3.0 and later you will use "us,ru". Here is an example of a modified stanza:
Section "InputDevice"
Identifier "Keyboard0"
Driver "keyboard"
Option "XkbLayout" "us,ru"
Option "XkbOptions" "ctrl:nocaps,grp:shift_toggle"
EndSection
If you don't like the Shift+Shift toggle, there are several other predefined options. The XFree86 documentation also mentions grp:caps_toggle, which uses Caps Lock to toggle character sets and also appears to be quite popular. Note that I don't know how this might interact with ctrl:nocaps. That's it! Restart your X server and you should be cruisin' with cyrillic input. |