Setting up international keyboard in X Window System with Xmodmap and XKB

How to setup international keyboard in X Window with Xmodmap and XKB
Prev |  | Next

# 2. Setting up international keyboard in X Window System with Xmodmap and XKB

## 2.1. Quick start

### 2.1.1. Xmodmap

Make your own .Xmodmap file according to information in this file.

Write the following to your .bash_profile in your home directory:

export LANG=language

where "language" is the language you want to use. The languages can be found in the file locale.alias in /usr/X11R6/lib/X11/locale. NOTE: some programs, like Mozilla, don't care about these user's locale settings. Run "exit" command on the console and log in again for Bash to read the statement from its .bash_profile.

Install fonts (best are ISO8859-2 Type1 fonts for Eastern Europe, Czech or Slovak), put them in your font path in the /etc/X11/XF86Config file (on some newer systems this is not necessary). Start X Server (startx). If you use GDM or XDM and your X server is already running, restart X server. Run the command "xmodmap /.Xmodmap" from the X terminal window to force the system to read the .Xmodmap file. The dot does not have to be there. Name the xmodmap keyboard map whatever way you want. Switch keyboard by pressing a key (it is usually right Alt, Scroll Lock, it depends on how switching is defined in the xmodmap file). That's all. NOTE: This HOWTO is for the X Window System, use of national keyboards on the console is not explained here. If you are desperate, try to issue the commands like:

setfont LatArCyrHeb-14 -m 8859-2

followed by

loadkeys sk

("sk" stands for the Slovak language). Most Linuxes have their own utilities to set up console keyboards).

### 2.1.2. XKB

Provided you have your fonts installed, just open the X terminal window and issue a command: setxkbmap kb, where "kb" is the keyboard layout you want to use, for example:

setxkbmap si

for the Slovenian language

setxkbmap de

for the German language

All the language names you may use are located in /usr/X11R6/lib/X11/xkb/symbols directory.

Alternatively, if you are using KDE 2.0, open the KDE Start button, click on Preferences, Personalization, Country & Language and choose ISO8859-2 charset. Note that this may be slightly different depending on the Linux or KDE distribution. In newer Linux distributions you don't have to do this anymore; in Slackware Linux 8.1, RedHat 8.0 or Mandrake 9 with KDE 3.0, for example, just open Preferences, Peripherals, Keyboard - choose your keyboard layout and everything should work fine (if you have the fonts pertinent for the language of your choice installed, obviously).

You will see a language icon on the KDE panel. Switch the keyboard (NOTE: this is for XKB, my xmodmap definition uses Scroll Lock for switching, other xmodmap files use Right Alt) and enjoy.

You may alternatively edit the /etc/X11/Xf86Config file as explained in the Danish Howto, or issue this command in an X terminal window for the Slovak keyboard:

setxkbmap -model pc102 -symbols 'czsk(us_sk_qwertz)' setxkbmap cs -option grp:shift_toggle

In RedHat 7.2 and Mandrake 8.1, it is enough to run the following setxkbmap command from an X Terminal Window (assuming you have correct fonts installed):

setxkbmap sk

setxkbmap si

setxkbmap de

qwerty or qwertz means that the letter z Z and y Y are swapped.

To see a variety of language maps (symbols), look in the file symbols.dir in /usr/X11R6/lib/X11/xkb directory.

Some X Window managers override .Xmodmap setting. If .Xmodmap isn't read by X automatically after starting the X Window System, a good way is to force the system to read it from your root (home) directory. You will do this by issuing the following command from an X terminal window:

xmodmap /.Xmodmap

After I installed the Slovak keyboard in KDE with Xmodmap file that used definitions for ISO8859-2 keycode entities (lcaron, scaron, etc.), some changes had to be done in the system in relation to a Linux or XFree distribution. The changes mostly pertained to dead keys that did not work.

Prev | Home | Next
Introduction |  | How to do it: this experimental solution is a legacy issue - do not read it if you use newer systems