I really need to be able to write in multiple languages, using multiple keyboard layouts and I managed to oversee this aspect while migrating to my new system… well, it’s time to fix it.
To set up multiple keyboard layouts on your crunchbang/debian setup you have to define the layouts that X is going to use first.
To do this, fire up you terminal and edit /etc/default/keyboard.
$ sudo vim /etc/default/keyboard
The content should look like this:
XKBMODEL="pc105" XKBLAYOUT="us,ro" <-- these are 2 char country codes. `ls -la /usr/share/X11/xkb/symbols/` to list all of them XKBVARIANT=",std" <-- these are variants, defined inside the layout files available in /usr/share/X11/xkb/symbols/ XKBOPTIONS="grp:alt_shift_toggle"
Add as many layouts as you wish in the XKBLAYOUT setting. Don’t forget to set a variant, if your keyboard requires it. I’m using standard for Romanian. A typical us variant is international… so beware.
XKBOPTIONS sets the key bindings that will toggle the keyboard layout and alt_shift_toggle lets you use ALT+SHIFT to toggle between the layouts, Windows style.
Now just reboot or restart X anyway you can to start using your multiple keyboard layouts.
To switch visually and to have an indicator of the current layout I’m using fbxkb, which starts from Openbox’s autostart. To do this, just add the following line to the end of the autostart file (the file is usually in ~/.config/openbox/):
Fbxkb is a wonderful tool, although a little ugly.
You can change the status indicator flags (the default ones are just some images that contain the country codes) simply by copying new 24×24 pixel flags or other images to /usr/share/fbxkb/images.
Now isn’t that sweet? It works too 🙂