ZoneO-tips for Mandriva Linux

Enter european accented characters on an american keyboard

In Mandriva 2006, how do you enter european special characters on an american keyboard?

 
 

Old problem! It should have been sorted years ago with the introduction of the Compose key. But here is the problem: most keyboard sold in shops do not include this compose key...

There are several ways to create a Compose key,

The Compose key

Ok, what's a Compose key anyway? Well, it's quite simple: it's a key that you can use to combine symbols and create special or accented characters that are not on your keyboard... For instance, on my keyboard, the right-Alt key is set as Compose (see below) and if I type on the Alt and , keys (together) and then c, I get a ç. Great, isn't it!

There are tons of combinations, and I'll show you some of them but do not hesitate to experiment:

Alt-, + c = ç
Alt-, + C = Ç
Alt-' + A = Á
Alt-' + a = á
Alt-` + E = È
Alt-` + e = è
Alt-^ + o = ô
Alt-^ + O = Ô
Alt-" + u = ü
Alt-" + U = Ü
Alt-s + s = ß
....

All in all, it's quite usefull if you want to type european languages...

Create a Compose key in X.org

For those who would not know, X.org is the main graphical interface on modern Linux systems. It's in charge of most graphics related operations, as well as mouse and keyboard. Its configuration file is located at:

/etc/X11/xorg.conf

To add a Compose key in X.org, you should look for the section on keyboard within this file, in my case

Section "InputDevice"
    Identifier "Keyboard1"
    Driver "keyboard"
    Option "XkbModel" "pc101"
    Option "XkbLayout" "en_US"
EndSection
and add the line
    Option "XkbOptions" "compose:rwin"
at the end of this section. It will add a Compose function to the Windows key located on the right side of your keyboard. You can also add this function to the Right-ALT key with
    Option "XkbOptions" "compose:ralt"
or the menu key with
    Option "XkbOptions" "compose:menu"

Usually, it works fine... You just have to restart X and that's it. Unfortunately, my keyboard does not have a Windows key, nor does it have a Menu key, and the Right-ALT key did not work with this technique! I really do not know what is happening, it must be a bug with the latest version of Mandriva...

Create a compose key in KDE

Options for a compose key in KDE
Figure 1: Configuration of a Compose key in KDE

Ok, let's keep quiet... I do know a second solution: the KDE control center. Start the KDE control center and choose one of the first options, Accessibility > Keyboard layout, and the panel Options xkb (Figure 1).

In this panel, you can define a Compose key, and usually, it works. Obviously, with my weird system, it did not do anything! Damned, go to find something else...

 

The ultimate solution: xmodmap

Ok, there was only one solution left: xmodmap... It's one of those typical Unix utilities, you never know how to use them, their manuals are famously unreadable, but you couldn't live without their functionalities! This one can change any keyboard or mouse event, handy isn't it!

So, to get a Compose function on the Right-Alt key, you need to create a file called .Xmodmap in your home directory, with the following content

keycode 113 = Multi_key
that will tell X.org that the key 113 shoud activate Multi_key mode, our famous Compose function...

How did I know that the Right-Alt key was numbered 113? With xev... Another one of those Unix utilities. You can use it to detect any X windows event. Just type xev in a konsole and you'll understand what I mean.

Anyway, once our .Xmodmap file is created, you just have to activate this function with

xmodmap .Xmodmap
Miracle, it worked!!

The only thing that remains is to activate this function automatically when you log in. To get this, go into the ~/.kde/Autostart/ folder, create a file called compose_key.sh with the following content

#!/bin/sh
xmodmap ~/.Xmodmap
exit
and make it executable (chmod a+x ~/.kde/Autostart/compose_key.sh). Each time KDE will start, this file will be run and it will activate the Compose function, finally!

Links

 
 
06/2006
 
© ZoneO-soft - Contact us - Start page