Getting French Characters On Your English Keyboard With Gnome

Photo of Greg Harvey
Sun, 2010-01-24 20:36By greg

Those familiar with Windows (and I guess Mac OSX too) will probably be aware that you can get an é character from your keyboard by pressing AltGr + E. You may not be aware that in Linux you can't. This was a bit of a problem for me, as I live in France, a country who's native language relies rather heavily on the accents in the special character set. For example, the town I'm in is called Uzès and my daughter is called Moïra. It's also been driving my wife bananas, since she actually needs to write emails and letters in French but we have British keyboard layouts.

For the last year this little issue has been ignored, largely because I could not figure out for the life of me how to make Linux do special characters (easily, at least - the character map is no solution). In spite of infrequent, but dogged attempts to Google a solution, I found the problem is people usually loosely describe a solution with the assumption of a degree of knowledge I lack about Gnome, the Linux desktop solution I use.

Well, I finally worked out the easiest path to victory, thanks in no small part to this excellent blog post on the matter. The author there notes there are several ways to get Linux to do special characters. The simplest being to hold down Ctrl + Shift and type the UTF hexadecimal code for the character you're after. This does work right out of the box, but this, like character map, isn't really a solution - asking my wife to memorise half a dozen hexadecimal numbers was not going to be greeted with enthusiasm.

The thing this blogger notes, which I hadn't heard of before and was the significant missing piece when it came to cracking the issue, was the Linux concept of a "third level" and "fourth level" keyboard. (Keyboards of special characters accessed by pressing the AltGr key or AltGr + Shift.) This, I realised, was the Windows feature I was missing! It's actually there all along, but for some reason it is off by default in Gnome. Crazy!

So, STEP ONE: To enable it (in Fedora 10, but steps will be similar in all Gnome desktops, though menu items may be slightly differently labelled or ordered) go to System -> Preferences -> Hardware -> Keyboard. Click on the Layouts tab and click on Layout Options (it's a button there). Expand the "Third level choosers" option set and tick "Press Right Alt key to choose 3rd level". Close, and you're done. The Linux keyboard will now behave like the Windows keyboard (special characters with AltGr pressed).

However, it seems the "international" layouts containing the special characters are, again, there but not enabled by default. Again, crazy! Why this is I do not know, as they are default in Windows so it's fair to assume people expect them and it seems a silly feature to make people jump through hoops for when it should just be there by default. But anyway, there is no Linux keyboard layout for United Kingdom international, sadly (I might look in to making my own). There is a USA International keyboard layout though, which has accents where you'd expect if you're used to Windows. To add it:

On to STEP TWO: Go back to System -> Preferences -> Hardware -> Keyboard and click Layouts again. Click the Add button (dur). Pick Country of United States and pick from Variants "USA International (AltGr dead keys)". Close and you now have two layouts enabled. However, if you're British you probably still want a UK layout most of the time, so set your UK layout as default.

The final trick is to know which layout is currently active and see what the third and fourth level options are for that layout. This messed me up too - I couldn't figure out how to actually get at the Gnome Keyboard Indicator. Most people on the Internet assume that telling someone to "Add a Panel" in Gnome tells them everything they need to know about how to switch on the Keyboard Indicator, but since numb-nuts here didn't know what "Add a Panel" meant, finding a tutorial that actually *showed* you how to do it was not so easy. Eventually I did:
http://www.my-guides.net/en/content/view/161/26/1/4/

STEP THREE: Using the very last step from that link I got my layout selector up in the top bar of my desktop. Just click it to switch layout from UK to USA International. And this is the really cool bit: right-click it and select "Show Current Layout" brings up a preview of the keyboard, showing you where all the special characters are hiding. Marvellous!

The slight pain is having to flick to the USA layout to get the international characters (@ and " switch places, etc.) but it's not too bad, and I suspect it's easily remedied if I can be bothered to find (or make) a UK international layout.

One thing to note. If, like us, you want to write in French then the USA International layout is still not hugely useful. It has no grave accents, for some weird reason. Now you know how to add, switch and view layouts, I suggest trying some other layouts which have the special characters you need more readily accessible.

Canada Multilingual or Switzerland French both look to be good options for French writers. They are QWERTY layouts but with the é, á, etc. mapped to first and second level keys for convenience. Since you have to switch layouts anyway, you might as well switch to a layout natively intended to support your target language on a QWERTY keyboard. We're going to road test Canada Multilingual.