How do I input Greek characters in Ubuntu?

17

6

I'm taking a course in Greek, and would like to be able to store notes and such on my laptop.

I'm using Gnome, but I also use a flash card program called "Mnemosyne" that is written in Qt, if that makes a difference.

I installed the "Greek" language from "Language Support". I also went to "Keyboard" and tried to change the layout, but that didn't work (apparently, I should be able to press both alt keys at once to switch layouts, but that doesn't do anything. I added a Greek layout to the list).

Matthew

Posted 2009-08-24T18:14:15.590

Reputation: 11 686

I changed the switch key-combination to "Alt + Space", and it works now. Does anyone know what could be catching the "Alt + Alt" combo? – Matthew – 2009-08-24T20:09:16.030

Not sure. Ctrl-Ctrl doesn't work for me either. – innaM – 2009-08-26T09:13:50.807

Answers

13

Σιμπλζ αδδ τηε Γρεεκ λαζοθτ το ζοθρ Κεζβοαρδ λαζοθτ πρεφερενψεσ. Τηεν αδδ τηε Κεζβοαρδ Ινδιψατορ αππλετ το ονε οφ ζοθρ παλελσ ανδ θσε τηατ το σςιτη λαζοθτσ.

Simply add the Greek layout to your keyboard layouts. Then add the "Keyboard Indicator" applet to one of your panels and use that to switch between layouts. It seems to work for me.

Edit:

Changing the layout via a key combination seems to be a bit flaky:

Choose "Layout options" in the Keyboard preferences dialog and find the group of options labled "Keys to change layout". You will then simply have to try the different options and see which one works for you, both on a system level and a usability level. I guess for the option that says "both alt keys" you will need two Alt keys (I have only one here). On the other hand, I definitely have to Ctrl keys, but the "Both Ctrl keys" option doesn't work for me either.

I understand that you want to avoid cluttering your panel, but my guess is that you will need some sort of indicator of the current layout or you'll find yourself constantly typing in the wrong one. Of course, your mileage may vary.

innaM

Posted 2009-08-24T18:14:15.590

Reputation: 9 208

This works well. I'd still like to be able to use the keyboard to switch instead, to avoid panel-clutter. See my comment on the original question. – Matthew – 2009-08-24T20:10:13.390

24

If you just want to enter a couple a Greek characters, I would find their Unicode character number and use Unicode composition.

For example:

U+03D0 GREEK BETA SYMBOL
Ctrl+Shift+u+0+3+d+0+<Enter>
ϐ

hendry

Posted 2009-08-24T18:14:15.590

Reputation: 1 234

6That way he will not restrict himself to learning Greek, he'll also learn Unicode. – innaM – 2009-08-26T09:13:01.950

8Why bother down rating this answer? You're assuming that if ppl Google for "How do I input Greek characters in Ubuntu?", they are going to learn Greek next? Don't be silly. My response is helpful to some. – hendry – 2009-08-26T09:53:37.357

2@hendry: If it makes you feel better, I up-voted you :) – Matthew – 2011-07-10T00:43:00.523

2This is precisely the answer that I needed, thanks! – Ian Ni-Lewis – 2013-04-30T19:11:21.987

10

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

If the 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 Shift and 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 <Multi_key> v /, 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 <dead_greek>.

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:

include "%L"
<dead_greek> <c>            : "∂"   U2202    # PARTIAL DIFFERENTIAL
<dead_greek> <C>            : "∇"   U2207    # NABLA

The 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 .xsessionrc script:

export GTK_IM_MODULE="xim"
export QT_IM_MODULE="xim"

Enjoy!

MiniQuark

Posted 2009-08-24T18:14:15.590

Reputation: 540

Is there any reason this should fail if I attach it to the F9 key? https://askubuntu.com/questions/945240/how-to-get-dead-greek-on-the-f9-key

– edA-qa mort-ora-y – 2017-12-05T12:30:58.727