Setting Up International Keyboards LG #53

« Linux Gazette…making Linux just a little more fun!« 

This xmodmap and kimap solutions will work for you in setting up any international keyboard for (Debian, RedHat, Mandrake, Corel Linux) Linux, FreeBSD, OpenBSD, NetBSD and possibly every Unix that uses Xfree86 and KDE. The advantage of this package is that it is not architecture specific and will work on SPARK, MIPS and all other systems. I don’t want to say that other packages are architecture independent, but I don’t like writing garbage in the bash_profile and XF86Config or possibly somewhere else. This was written by Juraj Sipos (c) on 4/22/2000,


Imagine you use Linux or a BSD OS and want to write a business letter to a person that has a foreign name with a slash or idiaresis. Danish language uses signs like ø and Portuguese like ñ. With this information you can make your own international keyboard layout without installing any additional packages. The following information will help you set up German, Spanish, Italian, Slovak, Czech, Polish, Slovenian, Croatian, Danish, Dutch, French, Finnish, Norwegian, Estonian, Latvian, Swedish and other keyboards without additional installing of national packages and without writing garbage to bash_profile and XF86Config files. You can also alternatively look at my homage at
to see pictures of various keyboards. In case you want to install Greek, Hebrew or Russian language, follow my information and apply changes pertinent to these languages (e.g., to install Greek fonts, etc.).

The biggest problem with kikbd or international keyboard under KDE in X Windows is that it doesn’t work in Xfree86 that easily (you have to install some national packages and write garbage with complicated syntax to the above-mentioned files). A user expects a simple way for configuring his or her keyboard for international settings. A simple way is to start KDE, change the international keyboard settings and immediately write in the language we chose (this will work for German and other languages, but in Eastern European keyboards some letters don’t function). According to the KDE documentation it should work, but it doesn’t. After exploring many KDE resources on the net, I didn’t find a solution (except for the one that forces you to install some national package). I know that some locale settings should be included in my bash_profile or csh logic scripts, but after applying these settings I couldn’t change (and install) keyboards in FreeBSD and it appeared like going through a darker forest compared to the information I already had regarding localization of KDE and X Windows under Xfree86.

Here are some solutions for installing international keyboard layouts.  The following information will help you set up any European keyboard layout. The solution works for Xfree86 in 3.1 RELEASE in FreeBSD (.Xmodmap solution), Corel Linux, Debian Linux, RedHat and FreeBSD 3.3 RELEASE and 4.0 RELEASE (KDE *.kimap solution). I tested it on those systems. Note: .Xmodmap solution works well with other windows managers. Some Unixes override .Xmodmap setting when used with KDE. If .Xmodmap doesn’t work, change must be made to the KDE kimap files in …/kikbd directory.

If .Xmodmap solution doesn’t work in KDE, copy skz.kimap (at the end of this article) to /usr/local/share/apps/kikbd, which is your KDE keyboard directory. The problem with KDE is that after installing another keyboard, you have no chance to use it as KDE documentation doesn’t clearly state how to define your locale settings in a bash_profile. After I installed Slovak keyboard in KDE, I couldn’t write in Slovak or Czech, so I made few changes to skz.kimap file, which are explained later in this file. After applying these changes, no other changes are necessary – you don’t need to write any special commands to your bash_profile or XF86Config. BUT WHEN YOU INSTALL ANOTHER KEYBOARD in START/SETTINGS/INPUT DEVICES/INTERNATIONAL KEYBOARDS from your KDE menu, CHECK AUTOSTART. Then everything will work fine.  The difference between skz.kimap and sky.kimap (and csz.kimap and csy.kimap) is that y,Y and z,Z are swapped, so with skz.kimap or csz.kimap you will have z,Z instead of y,Y, but with sky.kimap or csy.kimap, y,Y doesn’t change its position on the IBM English keyboard layout.

How it all works:

a) Copy the « Compose » file from /usr/X11R6/lib/X11/locale/iso8859-2 to:
   /usr/X11R6/lib/X11/locale/iso8859-1  directory (yes, iso8859-1, not iso8859-2). Back up
   the original « Compose » file if you want (alternatively, copy other iso885*** Compose
   file to iso8859-1 directory).
b) Put the included .Xmodmap file to your root directory (Slovak language, or make your own
   .Xmodmap file) (or possibly put your own *.kimap file to the kikbd directory if Xmodmap
   will not work)
c) Install ISO8859-2 fonts (or other pertinent fonts).
d) Disable every « Scroll lock » uncommented line in your XF86Config, because our .Xmodmap
   uses scroll lock to switch between keyboards.
e) Put the appropriate fontpath for your newly installed fonts in your XF86Config file, if

The .Xmodmap solution may be applied to all  X keyboards except Hebrew, I suppose (I’m joking). The .Xmodmap file overrides all settings of keyboard layouts as defined in /usr/X11R6/lib/X11/xkb/symbols/, where are symbols for many international keyboards. The .Xmodmap solution will give you an enhanced Slovak typewriter keyboard layout.

READ  How Not To Re-Invent The Wheel LG #34

First, I must say that in my solution, different mapping is used for .Xmodmap file (and kimap file) for some ISO definitions. This means that the ISO definitions will either give you what they say they are (aacute [á], eacute [é], etc.), or they will not give you what they say they are (putting « threequarters » in your .Xmodmap file will give not give you « 3/4 » but « z » with a caron above it). For example, « mu » will give lcaron, « oslash » rcaron, etc. (Obviously, in other case you need to install some national packages to use « lcaron » definition instead of « mu »). Normally, you can not put « lcaron » to the .Xmodmap file, because it will not give you lcaron; you must write « mu » instead, or « guillemotright » for tcaron. I also tried hexadecimal numbers and they work. However, other  key definitions, for example, adieresis (a with two dots above it), uacute (u with slash above it), as well as dead_diaeresis do not require a substitution of other definitions and work pretty well as they’re defined everywhere (dead key is a key  you press, you hold it and nothing happens, but after pressing another key you will get a special letter). The original « Compose » file in …/iso8859-1 directory can be fully utilized for Slovak or Czech keyboard layouts (Polish, Hungarian, Slovenian, Croatian), but there is only one problem with the Slovak or Czech keyboard (and other languages too) layout – dead_caron doesn’t work. That’s why you have to copy the « Compose » file from the iso8859-2 directory to iso8859-1 directory, or alternatively, you can edit the « Compose » file in iso8859-1 directory and put all references about « dead_caron » from iso8859-2/Compose to iso8859-1/Compose file.

You can leave the Keyboard section in your XF86Config without much change. Put (if it’s not already there) the following in the « Keyboard » section:

Section « Keyboard »
Protocol « Standard »
XkbRules « xfree86 »
XkbModel « pc101 »
XkbLayout « us »

Some X Windows managers and/or environments override .Xmodmap settings, so if you use KDE and .Xmodmap doesn’t work, use kikbd keymap instead of .Xmodmap. (A sample kikbd kimap for the Slovak language is included at the bottom of this file). The Slovak/Czech/English keyboard layout  is switched to by scroll lock with .Xmodmap. You may use languages only with the applications that have access to your ISO-8859-2 (or other fonts) fonts (this may not work with StarOffice or with other applications that have their own built-in fonts). StarOffice has its own fonts directory – afm fonts in ../xp3/fontmetrics/afm, and ps fonts in ../xp3/pssoftfonts, so you must add the ISO8859-2 fonts directory to these directories (to tell StarOffice to use these fonts too) and edit fonts.dir file and add the symlinked fonts there. I can easily use any language in StarOffice.

Important note: If you want to exchange documents between StarOffice or WordPerfect and MS Word, you must include the information about windows 1250 encoding to the file you write (win1250 is similar to iso8859-2, but it’s a little bit different). There’s a solution: use a converter from iso8859-2 to win1250 (you can find one at my home page at

If you want to edit and make your own .Xmodmap keyboard layout definitions, I’ll explain one line of the .Xmodmap file to make clear what you should do. This explanation can be used for all keycodes.

For example, the line:

keycode 0x11 = 8 asterisk aacute 8

(note: keycode 0x11 is derived from xkeycaps utility)
says that the first pair, the default one, (number « 8 » and « asterisk ») will display number « 8 » when you press keycode 0x11 (« 8 »), will display asterisk when a « shift » key is pressed. After pressing the scroll lock, there’s another definition: ISO_NEXT_GROUP, which means that when you press the default « 8 » key, no « 8 » will be displayed, but aacute (« á »), when you press the « shift » key, number « 8 » will be displayed. So if you change « aacute » and « 8 », anything you put instead of « aacute » and « 8 » will be displayed, for example:

keycode 0x11 = 8 asterisk semicolon colon

will give you « semicolon » and « colon » in your 0x11 keycode after pressing the scroll lock. If you delete the ISO_NEXT_GROUP (the next pair of definitions on the right), you will have only one group of keyboard definitions (« 8 » and « asterisk »). Be careful when editing the .Xmodmap file. You mustn’t delete definitions that enable utilization of the scroll lock unless you know what you are doing. These are the lines such as:

keycode 0x4e = ISO_Next_Group
add mod5 = ISO_Next_Group

etc. You must also keep in mind that Unixes are case sensitive.

If you want to find out more about keycodes, install a package « xkeycaps ».


! This is an `xmodmap’ input file for PC 101 key #2 (FreeBSD/XFree86; US)
! keyboards created by XKeyCaps, modified by Juraj Sipos on 8/17/1999.
! XKeyCaps 2.38 is Copyright (c) 1997 Jamie Zawinski