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 Responses to “Set up a keyboard layout for Xorg”

  1. 1 vespas 2010/03/20 at 10:39 PM

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

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

  1. 1 Links 21/3/2010: LXDE in Google Summer of Code, CrunchBang Moves to Debian | Boycott Novell Trackback on 2010/03/21 at 7:04 PM
  2. 2 GoblinX Project » GoblinX Newsletter, Issue 242 (03/21/2010) Trackback on 2010/03/21 at 10:36 PM
  3. 3 A quick swing past autofs « Motho ke motho ka botho Trackback on 2010/06/05 at 8:04 AM
  4. 4 hal’s day of reckoning « Motho ke motho ka botho Trackback on 2010/06/22 at 11:08 PM
  5. 5 keyboard configuration in Xorg: deadkeys, hal, evdev, what? Trackback on 2010/12/19 at 10:48 AM

Leave a Reply

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

You are commenting using your 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


Visit the Wiki!

Some recent desktops

May 6, 2011
Musca 0.9.24 on Crux Linux
150Mhz Pentium 96Mb 8Gb CF

May 14, 2011
IceWM 1.2.37 and Arch Linux
L2300 core duo 3Gb 320Gb

Some recent games

Apr. 21, 2011
Oolite on Xubuntu 11.04
L2300 core duo 3Gb 320Gb

Enter your email address to subscribe to this blog and receive notifications of new posts.

Join 405 other followers


This work is licensed under the GNU Free Documentation License. Please see the About page for details.

Blog Stats

  • 3,957,873 hits



Get every new post delivered to your Inbox.

Join 405 other followers

%d bloggers like this: