Introduction

Entering non English text, or more accurately non ascii text at the keyboard in X windows can get quite complicated. Worse is the fact that it's not very well documented.

The easy way out is cut & paste, but that doesn't scale, as it's awkward to be switching away from what you're currently writing to find and select various characters.

Note the following was tested on the Fedora Core 1 linux distribution, but should apply to anywhere X windows (XFree86 or X.Org) is running. NB: The following is with the UK keyboard layout, but will mostly apply to the US international layout also. If you only have the stanard US layout configured, then the AltGr key won't be available for example.

Viewing the current keyboard map

The command xkbprint -ll 1 :0.0 -o shift_level_1.ps will output a postscript file giving a pictorial representation of your keyboard map. I rendered this for my layout (pc105+gb) and modified it slightly to give:

British 105 key x windows level 1 keyboard layout

Selecting the alternate map

Notice the ISO_Level3_Shift key to the right of the spacebar above. This says that this "level 3" shift is bound to the AltGr (Alternate Group) key. This means that when you hold this key you have a different keyboard map, which can be generated by changing -ll 1 to -ll 3 in the command above, giving:

British 105 key x windows level 3 keyboard layout

So for example to type € and ¼ one does AltGr4 and AltGrShift4 respectively.

Here is an area you can type into for practice in this document:

Using the dead keys

The coloured keys (that I had to highlight manually unfortunately) in the "level 3" map above are dead keys. This means that they only take affect after a subsequent key is typed. For example to enter "Pádraig is naïve" you use AltGr; a and AltGr[ i. Note you can't press the subsequent key with AltGr held as that would be a different map, and I represent the fact that no keys should be held, with a wider space in this document. Note also that these dead keys are not exclusive to the "level 3" map but are all configured here for my layout.

Using the Compose key

The Compose key (or Multi_key in X terminology) can be seen in the first map above to be bound to ShiftAltGr. Note there is a subtlety here in that the combination AltGrShift has a different meaning, which should be apparent when you compare the 2 maps above. The compose key is similar to dead keys (and easier to use in my opinion) in that it modifies the meaning of subsequent keys. Note I highlight the plural keys as this is where the compose key is different. The character selected is determined by the subsequent character combination (usually 2). The character combinations used are easy to remember or even guess as the resulting character can be thought of combining the characters together. So to enter € for example, it looks like C with = through it so ShiftAltGr C = is what you enter. Here are some more examples:

compose charsgenerated charSimilar chars
C= 
c|¢ 
Oc© 
Y=¥ 
^0° 
^1¹²³
aeæ 
+-± 
:-÷ 
xx× 
 
'aááćéíĺńóŕśúýź
`aààèìòù
^aââêîôû
"aääëïöü
~aããñõ
,cççşģķļņ

The handiest way I've come up with to find the the compose character combination for a particular character is to pass the character as a parameter to this script. Note GTK+ applications use a different input method to X by default and so there can be some discrepencies from what is indicated by the above script. One can instruct GTK+ to use the X input method so that the compose map above is accurate. I did this by adding export GTK_IM_MODULE=xim to /etc/profile and restarting the system. Note with the GTK+ input method one can enter Ctrl+Shift+unicode to enter a char. For example to enter a € in gnome-terminal/gvim/gedit etc. one can do Ctrl+Shift+20AC.

More information

For more advanced information, like modifying the keyboard map I refer you to the following:

The international keyboard HOWTO
An Unreliable Guide to XKB Configuration
Pango input resources notes
Xkeycaps - A graphical xmodmap editor

© Sep 9 2005