If you just want a few Greek characters (e.g., for math equations), then I highly recommend using XCompose. Here is how.
1. Find your
dead_greek key (or define one)
By default, XCompose is configured to use a special
<dead_greek> key. You can check what is your
<dead_greek> key by running the following command:
$ xmodmap -pke | grep dead_greek
For example, on my system this command outputs:
keycode 191 = dead_greek dead_greek dead_greek dead_greek
This means that key 191 is my
<dead_greek> key. On my keyboard this corresponds to the
F13 key. If you are not sure which key the keycode corresponds to, you can run the following command and type all keys until you find the one with the right keycode:
$ xev | grep keycode
xmodmap command above returns nothing, it means that you do not have a
<dead_greek> key assigned. To assign one, first find the keycode of the key you want to assign using the
xev command above, then type the following command (replacing 191 with whatever keycode you want):
$ xmodmap -e "keycode 191 = dead_greek dead_greek dead_greek dead_greek"
The four repetitions of
dead_greek are for various combinations of the
<dead_greek> key with the
AltGr keys. You will probably want to add this command to your
~/.xsessionrc script so that it runs automatically every time you login.
2. Type Greek characters, and more! :)
Now you can try typing your
<dead_greek> key followed by the letter e or p, and this should print ε or π.
But wait, there's more! If you type
/, you get √. On my system, the
<Multi_key> is the
Caps Lock key.
And there are actually a lot more key sequences predefined. If you want to find what other characters are available, look at the file
/usr/share/X11/locale/en_US.UTF-8/Compose (change the
en_US.UTF-8 directory to match your locale if necessary) and search for
3. How do I define more key sequences?
If you want to add more key sequences for greek characters (or for any unicode character, in fact), you can create an
.XCompose file in your home directory, for example:
<dead_greek> <c> : "∂" U2202 # PARTIAL DIFFERENTIAL
<dead_greek> <C> : "∇" U2207 # NABLA
include makes sure you keep the key sequences defined for your locale. In this example, we add two key sequences for ∂ and ∇. Okay, these characters aren't actually Greek, but they look like they do, so who cares?
4. What if it fails?
If some apps ignore your personalized key sequences, you may need to add the following environment variables to your