Russify Your X

I always wanted to write a tutorial like this one, I was just waiting until they get to the point where it is actually simple.

Part 1: Set up the keyboard in X.

All you need to do is to configure the Xkb module. In your XF86Config, have these parameters set in the Input Device section for your keyboard:

Option "XkbRules" "xfree86"
Option "XkbModel" "pc104"
Option "XkbLayout" "en,ru"
Option "XkbVariant" "winkeys"
Option "XkbOptions" "grp:shift_toggle"

This will give you the standard jcuken layout and shift-shift toggle sequence. I don't know many X applications where this is useful, but Mozilla and its Composer are some of them, and that's all I, personally, care about.

For more options, check out the documentation in Xkb root (on most systems, /usr/X11R6/lib/X11/xkb/ is where it is).

Note: Older versions of Xkb may be happier with just "ru" in XkbLayout field.

Part 2: Set up Emacs.

I use Emacs 21.3.2, and the matching version of Leim. I was mostly interested in being able to edit the HTML files containing the Russian text, while keeping things compatible with Mozilla's Composer.

First thing you need to know is how to switch to the Russian input. The sweetest part is that it can be done independently of the X setup. Just invoke

[C-\] cyrillic-jcuken

and you are set. Invoke it again to switch back.

Due to the flow of Emacs magic, this is already enough to reply to the Russian articles in Gnus -- no extra steps required. I'm sure, more work will be needed for composing a new piece of Russian mail from scratch, but I never had a desire to do so.

Now, you are ready to edit HTML. If you start with Composer, save your file as charset UTF-8. In Emacs, invoke

[C-x-Enter c] utf-8 [C-x C-f] your-file.html

which will open the file using the proper encoding. Switch between Russian and English as described above.