Special characters in linux

One of the (minor) recurrent problems i ever had with linux involves special characters such as é, è, à, ç and so on using my QWERTY keyboard. Indeed, as someone who must very often type in french, these characters are almost vital! )

keyboard

Having been raised the windows way of doing this (alt + 130 power! D ) I was totally lost on how to do this in linux. after almost a year though, i finally discovered there was a rather quick and easy way to do this: the Compose key.

First of all I will try to explain the concept of this compose key. To put it simply, 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 left winkey is set as compose key. thus by pressing [winkey] then [’] and [e], i get an é. similarly, [winkey] [=] [e] gives the euro sign €.

please Note that these keys are to be pressed one after the other (unlike the traditional ctrl+alt+delete for example ) )

Now, ready to set that compose key? let’s go, i promise that will be real quick P

First open your terminal and open your xorg.conf

$ Sudo nano /etc/X11/xorg.conf

Please feel free to use any text editor (graphical or otherwise) here, i just chose nano to be more accessible irrespective of specific WMs

This should open your xorg.conf file, which contains configurations for most graphics related operations as well as your mouse and keyboard.

To set your compose key you should look for the section on keyboard within this file. in my case it looks like this:

Section “InputDevice”
Identifier “Keyboard0″
Driver “keyboard”
Option “CoreKeyboard”
Option “XkbRules” “xfree86″
Option “XkbModel” “pc105″
Option “XkbLayout” “us”
EndSection

Here, you just have to add a new line

Option “XkbOptions” “compose:lwin”

just before the endsection. (i have chosen the lwin key personally. you can replace it with anything like lalt, lctrl rctrl etc ) )

if your xorg.conf already contains a line starting with “Option “XkbOptions” ” (for example “Option “XkbOptions” “lv3:ralt_switch”) all you have to do is to add a comma and the mapping for the compose key inside the second double quotes (which in my example would give something like “Option “XkbOptions” “lv3:ralt_switch, compose:lwin”) i don’t know if i’m being clear here, just ask in the comments if you do not understand P

here we go ) now just save the file, restart x, and your compose key should be up and running P

And oh, before i forget, here you can find a list of key sequences with the compose key )

enjoy, and if there are any queries, the comment form is here P

>>Jump to comment form, or trackback from your own site.



3 Responses to “Special characters in linux”

  1. See my profile on MyBlogLog.com! Leo Says:

    Yups, nice post )
    (et moi j’ai un train de retard mais bon P )

    In some distros (fedora & parsix for instance) this can be done within the wm’s options themselves. currently using osx now but if i remember correctly, system>hardware>keyboard (or something similar) should give a window where you can config the compose key among others )

    m’enfin i guess its best to bet on the xorg.conf way though, since its distro/wm independant )

  2. See my profile on MyBlogLog.com! Kyu Says:

    @Eddy, thanks for the info! )

    Dead keys sound much more practical to me than my good old “alt+xxx” to get my special characters in windows at least ) i agree though, i very much like the Compose key’s concept.

    Well, at least now i will not need to do weird manipulations / tinkering with keyboard layouts in order to type special characters, great )

  3. See my profile on MyBlogLog.com! Eddy Young Says:

    Very nice post, Kyu. Shame you didn’t find this earlier; would have extended the sanity of your extremities!

    In Windows, if you set your keyboard to “US International”, the diacritic keys become “dead” keys, meaning that they only take effect when followed by a second keypress. For example, if you press ‘ followed by e, you get an “é”. You can set X11 to use dead keys as well, but I much prefer the Compose key and would rather there was a Compose key in Windows too!

    FWIW, Mac OS X uses the the Alt Gr as a Compose key, but the diacritic keys are a bit odd (eg. to compose an “é”, it’s ComposeKey + e + e.

    Eddy.

Leave a Reply


roll yes =O wink smile =( =P no =| love lol grinnod =D 8) X


This blog is under a Creative Commons licence.

© 2008 Kyusphere