You can type characters beyond those on your keyboard in most X programs that use keyboard input (terminal emulators, web browsers inside text areas, etc.). This is done with libX11's Compose(5) feature. A multi-key input sequence is mapped to a character; for example, <Compose> <e> <'> generates the character é.

Once you have set this up, you can type accented letters (é å ù), other European characters (ç ñ), Greek letters (α β), or whatever else you choose to configure.

Standard way

The first step is to define a Compose key, also known as a Multi_key key. Many people choose to use one of the "Windows" keys, or the "Menu" key, or one of the "Alt" keys. Whichever key you choose, run an xmodmap command to assign it a new meaning. For example, to use the Left Windows key:

xmodmap -e "keysym Super_L = Multi_key"

Make sure this command is executed whenever you login to X, for example by placing it in your ~/.xsessionrc file. Other files may be used, depending on how you start X, which Desktop Environment you use, and so on. Once you have defined a Compose key, you should immediately be able to type the basic accented letters in a terminal emulator. The full list of default compose sequences may be found in /usr/share/X11/locale/en_US.UTF-8/Compose for reference. If you're happy with these, you may stop here.

The second step is to configure your own custom compose sequences. To do this, create a file named ~/.XCompose and make sure it has include "%L" at the top of it, to bring in the default sequences. After that, you may put whatever you like. For example,

include "%L"

<Multi_key> <g> <a> : "α"
<Multi_key> <g> <b> : "β"
<Multi_key> <g> <g> : "γ"

This file is read by libX11 whenever a new X program is started. So, your existing terminals won't be able to type these new characters, but any new terminals you launch will.

There is a bit of a chicken-and-egg issue with getting the desired characters into the .XCompose file in the first place. The easiest way is to find a web page that has the character(s) you want, and copy and paste them into your .XCompose definitions.


There is a simple GUI config to set a Compose key in KDE.

Enable config keyboard options
Disable annoying caps-lock
Set position of Compose key to caps-lock

The list of all the codes is in /usr/share/X11/locale/en_US.UTF-8/Compose - more bits under other specific locale.alias..

Also see

intl ?AltGr dead keys - can be used in combination with Compose-key.