Set up a keyboard layout for Xorg

A few weeks ago I whined that it was difficult to figure out how to set up an international keyboard in Xorg; I should have realized as I typed it that the Arch Wiki was the place to go to get the answer. And really, I should know better than to whine into the Internet at all. I should be leaving that to others. :twisted:

Regardless, if you’re not using a desktop environment that will handle keyboard switching for you, here’s what worked for me. And yes, it’s more or less straight from the Arch Wiki.

First, check which keyboard variant you need. For a list of possibilities, try

cat /usr/share/X11/xkb/rules/xorg.lst | less

and skim the list until you see the one you want. After that, copy one file to a new home, so you can edit it and override whatever Xorg thinks you should have. (I dislike it when the computer thinks it is smarter than me.)

cp /usr/share/hal/fdi/policy/10osvendor/10-keymap.fdi /etc/hal/fdi/policy/

Now edit that file and replace the necessary layout and variant codes with the versions you prefer. I know, this is the painful part; editing XML is like brushing a dog. It's sort of tangled and messy, and everything goes everywhere at once.

vim /etc/hal/fdi/policy/10-keymap.fdi

Once you've edited those and saved them back again, you'll need to restart hal for the changes to be applied.

/etc/rc.d/hal restart

You'll need to be root for that to work, or to have access to sudo. If you're already running X, you might have to close it and restart it again once hal has reawakened; I don't know if that's necessarily true, but I have a vague recollection of restarting hal from within a terminal emulator and not noticing any changes. But I might be wrong. I sometimes am. :|

From there you should be able to use your keyboard with the variant and layout you set. And if anybody ever asks you, you can tell them that there are two reasons Arch Linux is popular: The first is that it's just a good distro, and the other is that its wiki is like a bolt of lightning straight from Olympus. :D

About these ads

7 thoughts on “Set up a keyboard layout for Xorg

  1. vespas

    > cat /usr/share/X11/xkb/rules/xorg.lst | less

    I am sure you meant:
    less /usr/share/X11/xkb/rules/xorg.lst
    :)

    Reply
  2. Pingback: Links 21/3/2010: LXDE in Google Summer of Code, CrunchBang Moves to Debian | Boycott Novell

  3. Pingback: GoblinX Project » GoblinX Newsletter, Issue 242 (03/21/2010)

  4. Pingback: A quick swing past autofs « Motho ke motho ka botho

  5. Pingback: hal’s day of reckoning « Motho ke motho ka botho

  6. Pingback: keyboard configuration in Xorg: deadkeys, hal, evdev, what?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s