Karmic: Keyboard customizing w/o xmodmap

Using a german keyboard most of the time I have to press <Shift><7> to get a slash. Working in Unix this is not really convenient so I created an suitable .Xmodmap ages ago.

This worked rock solid until evdev was rolled out (e.g. in Hardy Heron if I remember correctly).

From that point of time my settings in .Xmodmap were gone after a Supend / Resume of my laptop.

As usual with Google’s help it turned out, that I was not the only one with this issue. But I could not find a solution.

Finally I changed the systemwide configuration file /usr/share/X11/xkb/symbols/de.

In the section xkb_symbols “basic” I changed the keys AB08 and AB09


key <AB08> { [ comma, semicolon, slash, multiply ] };
key <AB09> { [ period, colon, slash, division ] };

(On my current laptop keyboard AB08 is the best choice, but on a standard keybord its AB09, so I changed both).

For the sake of completeness: The files in /usr/share/X11/xkb/keycodes map keycodes to symbolic keynames. In my case the file evdev contains:


xkb_keycodes "basic" {
...
<AB08> = 59;
<AB09> = 60;
...
};

You may call the binary xev to get the keycode of any key (among other information).

Now on to another configuration task. I use my laptop frequently with a standard PS/2 keyboard, connected to the laptop via a little electronic device which connects to the laptop via USB. lsusb gives me:


Bus 006 Device 002: ID 074e:0001 Digital Stream Corp. PS/2 Adapter

For reasons completely unknown to me the key “less greater bar” (German keyboard, left to y, would normally be keycode 94) is completely dead (LEDs on the PS/2 Adapter do not even flash when pressing this key). Maybe this device was designed for US keyboards in mind, were no such key exists … In my old .Xmodmap I used the left Windows key (keycode 133) to replace the dead one.

Unfortunately keycode 133 is bound to the key , which is a modifier key in karmic. Run xmodmap -pm to check. I reconfigured the key to emit “less” and “”greater”, but pressing <LWIN> + <AltGr> I never got “bar”.

Finally I changed /usr/share/X11/xkb/keycodes/evdev to read:


// Microsoft keyboard extra keys
// <LWIN> = 133;
<AE13> = 133;
...
//// <AE13> = 132; // Yen

Again in file /usr/share/X11/xkb/symbols/de I added:


default
xkb_symbols "basic" {
...
key <AE13> { [ less, greater, bar ] };
...
};

This configuration works as fine as my old .Xmodmap did also after a Suspend + Resume. Unfortunately it took me quite some time to get this working. From a user’s perspective this stuff is not really well documented. Of course my changes will be eventually overwritten by an update.

If somebody knows how to make my changes on a per user basis, please share.

Advertisements

3 Responses to “Karmic: Keyboard customizing w/o xmodmap”

  1. bitsfritz Says:

    see:
    https://bugs.launchpad.net/ubuntu/+source/xmodmap/+bug/512622

    “xmodmap maps keyboard unusable”

    If You can confirm the bug, just hit the “Does this bug
    affect you?” button. ;o))

  2. linos Says:

    Currently being in the phase of migrating to Natty I still had to use my Karmic procedure. I did not find a better way to achieve it.

  3. linos Says:

    It still applies even in Oneiric.

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


%d bloggers like this: