4

I am trying to use Xmodmap to add some german diareses/umlauts to my keyboard, but Xmodmap is not working with them (but is with other remappings).

I am following this guide: German Umlauts on US Keyboard in X (Ubuntu 10.04).

Xmodmap

I have added this to my ~/.Xmodmap:

keysym a = a A adiaeresis Adiaeresis
keysym o = o O odiaeresis Odiaeresis
keysym u = u U udiaeresis Udiaeresis
keysym s = s S ssharp ssharp

xev

However it doesn't work. Here's the output from xev when I press o, hold down AltGr, press o, press x:

KeyPress event, serial 34, synthetic NO, window 0x4e00001,
    root 0x8e, subw 0x0, time 642618, (108,138), root:(173,190),
    state 0x10, keycode 32 (keysym 0x6f, o), same_screen YES,
    XLookupString gives 1 bytes: (6f) "o"
    XmbLookupString gives 1 bytes: (6f) "o"
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x4e00001,
    root 0x8e, subw 0x0, time 642644, (108,138), root:(173,190),
    state 0x10, keycode 32 (keysym 0x6f, o), same_screen YES,
    XLookupString gives 1 bytes: (6f) "o"
    XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x4e00001,
    root 0x8e, subw 0x0, time 643792, (108,138), root:(173,190),
    state 0x10, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XKeysymToKeycode returns keycode: 92
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x4e00001,
    root 0x8e, subw 0x0, time 645365, (108,138), root:(173,190),
    state 0x90, keycode 32 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x4e00001,
    root 0x8e, subw 0x0, time 645409, (108,138), root:(173,190),
    state 0x90, keycode 32 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 37, synthetic NO, window 0x4e00001,
    root 0x8e, subw 0x0, time 647660, (108,138), root:(173,190),
    state 0x90, keycode 53 (keysym 0xd7, multiply), same_screen YES,
    XLookupString gives 2 bytes: (c3 97) "×"
    XmbLookupString gives 2 bytes: (c3 97) "×"
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x4e00001,
    root 0x8e, subw 0x0, time 647722, (108,138), root:(173,190),
    state 0x90, keycode 53 (keysym 0xd7, multiply), same_screen YES,
    XLookupString gives 2 bytes: (c3 97) "×"
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x4e00001,
    root 0x8e, subw 0x0, time 650223, (108,138), root:(173,190),
    state 0x90, keycode 108 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XKeysymToKeycode returns keycode: 92
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

You'll note that pressing AltGr is interpreted as ISO_Level3_Shift, and when that and x is pressed, I get keysym 0xd7, multiply, i.e. ×, which is set as my 3rd level for x. So AltGr works.

$ xmodmap -pke | grep 53
keycode  53 = x X x X multiply approximate

However when I press o I get keysym 0x0, NoSymbol, despite my 3rd level set up:

$ xmodmap -pke | grep 32
keycode  32 = o O odiaeresis Odiaeresis

Same thing happens when I try to use AltGr + (a|u|s).

Xmodmap works for other remappings

Since my PgUp key on my laptop is small, I have remapped the num pad + to by Page Up in my ~/.Xmodmap, and that works fine. So my XModmap file is being (partially) read.

Why does my reassigments to o/a/u not work?

I am using Ubuntu 14.0.1 trusty with Ubuntu Unity.

1

Preliminary note: it appears that xmodmap has recently changed; old settings won't work.

For your case, look at the number of values for keycode 53 (6 values: x X x X multiply approximate), which works, and for keycode 32 (4 values: o O odiaeresis Odiaeresis), which doesn't work.

ISO_Level3_Shift will select the 5th or 6th value, but they are not set for keycode 32 in your case. Hence the keysym 0x0, NoSymbol result.

What you need is:

keysym a = a A a A adiaeresis Adiaeresis
keysym o = o O o O odiaeresis Odiaeresis
keysym u = u U u U udiaeresis Udiaeresis
keysym s = s S s S ssharp ssharp

But it may better to use XKB directly (example).

  • That was it exactly! By adding the extra letters, I can now type the characters. :) – Rory Dec 21 '14 at 8:29
0

To make the right Alt key work as Alt Gr, it needs to be mapped to Mode_switch instead of ISO_Level3_Shift, by adding the line

keycode 108 = Mode_switch

to ~/.Xmodmap:

keycode 108 = Mode_switch
keycode  38 = a A adiaeresis Adiaeresis
keycode  30 = u U udiaeresis Udiaeresis
keycode  32 = o O odiaeresis Odiaeresis
keycode  39 = s S ssharp

If you want the umlauts on the keys they have on the German keyboard, use:

keycode 108 = Mode_switch
keycode 48 = apostrophe quotedbl adiaeresis Adiaeresis
keycode 47 = semicolon colon odiaeresis Odiaeresis
keycode 34 = bracketleft braceleft udiaeresis Udiaeresis
keycode 20 = minus underscore ssharp

(You could combine them, of course.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.