2009-06-05
Sometimes one needs to type an accented character, and sometimes that someone is me.

Problem: I need to be able to enter accent characters such as ñ, é, æ, ¿, etc. when I'm typing. Back when I used a Macintosh computer, this was easily accomplished with a minor keyboard combination and in Microsoft Windows it was a major keyboard combination. How do I do the same thing on Linux? With an Xorg keyboard layout variant.

Since version 1.5 or so of Xorg, keyboard layouts are handled by HAL and since the default HAL policy file for keyboard layout will probably be overwritten when Hal is updated, the first thing to do is make a copy of the policy file into Hal's /etc policy folder. On my system, the policy file is located at:
/usr/share/hal/fdi/policy/10osvendor/10-keymap.fdi
and I copied the file to
/etc/hal/fdi/policy/10-keymap.fdi

Now it was time to edit the new file.

Since the file is already set to "us" on my machine, I only really needed to change the variant of the "us" layout to something that will allow me to enter accent characters. The policy file is a fairly simple XML file and I needed to only glance at the content to discover the following snippet:
<merge key="input.xkb.layout" type="string">us</merge> <merge key="input.xkb.variant" type="string" />

it would appear that the variant isn't set, so I need to pick a variant that will allow me to insert accented characters. I chose the "altgr-intl" variant and the new code snippet looks like:
<merge key="input.xkb.layout" type="string">us</merge> <merge key="input.xkb.variant" type="string">altgr-intl</merge>


Restart HAL, Restart Xorg, and BOOYAH!!! accented characters galore!

Wait, what is altgr-intl? "intl" is short for international, and altgr is short for "the right alt key". By pressing the right alt key in combination with certain other keys, I can enter international accented character. Had I chosen the "intl" variant, typing an apostrophe followed by certain keys will enter an accented character. Since I didn't want to deal with changing my standard typing style(I use a lot of apostrophe S contractions when I type), I opted for the altgr-intl variant.

Wikipedia has a nice SVG of the International US keyboard layout.

Yea! Now I can write café and not cafe.
Comments
I did a small writeup on multiple keyboards http://www.technographer.net/changing-xorg-keyboard-with-a-shortcut-independently-of-desktop-environment/ - but nowadays, with the entire HAL-and-input-hotplugging-thing the game has sort of changed...
2009-06-09 jezra:
Hi Morten, I don't think things have changed too much with the HAL hotplugging of input devices. One still needs to edit a configuration file and most of the configurations are the same in HAL as they where in xorg.conf.
Name:
not required
Email:
not required (will not be displayed)
Website:
not required (will link your name to your site)
Comment:
required
Please do not post HTML code or bbcode unless you want it to show up as code in your post. (or if you are a blog spammer, in which case, you probably aren't reading this anyway).
Prove you are human by solving a math problem! I'm sorry, but due to an increase of blog spam, I've had to implement a CAPTCHA.
Problem:
1 plus 4
Answer:
required
  • Tags:
subscribe
 
2016
2015
2014
2013
2012
2011
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008