0

My hp notebook has a german keyboard that seems to be a relabled version of a us keyboard. Because of this it lacks the <>| key that is usually located right of l-shift on german keyboards.

This is obviously very annoying and so far I haven't been able to find an alternative key kombination that will generate < or >. There seems to be a keyboard layout called E2 which fits my keyboard perfectly (https://de.wikipedia.org/wiki/Tastaturbelegung#Tastaturbelegung_E2). However there seems to be no support for it in Ubuntu 20 out of the box.

So does anybody know how I can get the E2 layout for linux or how I could create an alternative keymapping for < and >. The tutorials I found on the web on how to customize the keyboard layout seem to be outdated and I wasn't able to get them to work in Ubuntu 20.

Here is what I tried:

I tried to follow this tutorial https://help.ubuntu.com/community/Custom%20keyboard%20layout%20definitions.

I tried to remap ALTGR-Y to < and ALTGR-X to > using xkb.

I'm currently using the keyboard layout German (Macinthosh) so I edited the /usr/share/X11/xkb/symbols/macintosh_vndr/de file.

In the xkb_symobls "basic" section I've added the following mappings:

    key <AB01> {        [         y,    Y,      less,   guillemotleft           ]       };
    key <AB02> {        [         x,    X,      greater,        guillemotright          ]       };

Then I've rebooted but ALGR-Yand ALTGR-X still give me the wrong characters. :(

More information:

$ setxkbmap -print -verbose 10

Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules:      evdev
model:      pc105
layout:     de,us
variant:    mac,
options:    caps:escape
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwertz)
types:      complete
compat:     complete
symbols:    pc+de(mac)+us:2+inet(evdev)+capslock(escape)
geometry:   pc(pc105)
xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwertz)" };
    xkb_types     { include "complete"  };
    xkb_compat    { include "complete"  };
    xkb_symbols   { include "pc+de(mac)+us:2+inet(evdev)+capslock(escape)"  };
    xkb_geometry  { include "pc(pc105)" };
};

cat /usr/share/X11/xkb/symbols/macintosh_vndr/de

// [email protected]   very close to MacOS map

default partial alphanumeric_keys 
xkb_symbols "basic" {

    // Describes the differences between a very simple US/ASCII
    // keyboard and a simple German keyboard.

    include "latin"
    name[Group1]= "Germany - Mac";

    key <TLDE> {    [ dead_circumflex,  degree,    notsign      ]};
    key <AE01> {    [         1,    exclam,  exclamdown,   at       ]};
    key <AE02> {    [     2,    quotedbl,  twosuperior          ]};
    key <AE03> {    [     3,    section,  threesuperior,sterling    ]};
    key <AE04> {    [     4,    dollar,  onequarter,    currency    ]};
    key <AE05> {    [     5,    percent,  bracketleft           ]};
    key <AE06> {    [     6,    ampersand,  bracketright        ]};
    key <AE07> {    [     7,    slash,        bar,    backslash     ]};
    key <AE08> {    [     8,    parenleft,  braceleft,    asciitilde    ]};
    key <AE09> {    [     9,    parenright, braceright          ]};
    key <AE10> {    [     0,    equal,  braceright, degree      ]};
    key <AE11> {    [    ssharp,    question,  backslash,   questiondown    ]};
    key <AE12> {    [ dead_acute,   dead_grave,  dead_cedilla       ]};

    key <AD01> {    [     q,    Q, guillemotleft,guillemotright ]   };
    key <AD03> {    [     e,    E,   EuroSign           ]   };
    key <AD04> {    [         r,    R,  registered          ]   };
    key <AD05> {    [     t,    T       ]   };
    key <AD06> {    [     z,    Z       ]   };
    key <AD07> {    [     u,    U, diaeresis,    Aacute     ]   };
    key <AD08> {    [     i,    I,      slash,    Ucircumflex   ]   };
    key <AD09> {    [         o,    O,      oslash,   Ooblique  ]   };
    key <AD11> {    [ udiaeresis,   Udiaeresis,  periodcentered, degree ]};
    key <AD12> {    [      plus,    asterisk,  asciitilde           ]}; 
    key <AC01> {    [         a,    A,      aring,    Aring     ]   };
    key <AC04> {    [     f,    F       ]   };
    key <AC05> {    [     g,    G,  copyright           ]   };
    key <AC06> {    [         h,    H,  ordfeminine         ]   };
    key <AC09> {    [     l,    L,  at          ]   };
    key <AC10> {    [ odiaeresis,   Odiaeresis,  dead_acute         ]};
    key <AC11> {    [ adiaeresis,   Adiaeresis,  dead_circumflex        ]};

    key <LSGT> {    [      less,    greater,        bar         ]};
    key <AB01> {    [     y,    Y,  less,   guillemotleft       ]};
    key <AB02> {    [     x,    X,  greater,    guillemotright  ]};
    key <AB06> {    [         n,    N, asciitilde           ]   };
    key <AB07> {    [     m,    M,   mu         ]   };
    key <AB08> {    [     comma,    semicolon   ]   };
    key <AB09> {    [    period,    colon,  periodcentered, division    ]};
    key <AB10> {    [     minus,    underscore  ]   };
    key <BKSL> {    [ numbersign,   apostrophe,  dead_grave         ]};

    key <BKSL> {    [ numbersign,   apostrophe,  dead_grave         ]};


    include "kpdl(comma)"
    include "level3(ralt_switch)"
};

partial alphanumeric_keys 
xkb_symbols "Sundeadkeys" {
    // modify the default German layout to use Sun dead keys
    include "macintosh_vndr/de(basic)"
    name[Group1]= "Germany - Mac, Sun dead keys";

    key <TLDE> {    [ SunFA_Circum, degree,      notsign            ]};
    key <AE12> {    [ SunFA_Acute,  SunFA_Grave, SunFA_Cedilla      ]};
    key <AD11> {    [ udiaeresis,   Udiaeresis,  SunFA_Diaeresis        ]};
    key <AD12> {    [       plus,   asterisk,    SunFA_Tilde,  dead_macron  ]};
    key <AC10> {    [ odiaeresis,   Odiaeresis,  SunFA_Acute        ]};
    key <AC11> {    [ adiaeresis,   Adiaeresis,  SunFA_Circum       ]};

    key <BKSL> {    [ numbersign,   acute,       SunFA_Grave        ]};
};

partial alphanumeric_keys 
xkb_symbols "sundeadkeys" {
    include "macintosh_vndr/de(Sundeadkeys)"
};

partial alphanumeric_keys 
xkb_symbols "nodeadkeys" {
    // modify the default German layout to not have any dead keys
    include "macintosh_vndr/de(basic)"
    name[Group1]= "Germany - Mac, no dead keys";

    key <TLDE> {    [ asciicircum,  degree,    notsign          ]};
    key <AE12> {    [ acute,    grave,  cedilla             ]};
    key <AD11> {    [ udiaeresis,   Udiaeresis,  diaeresis          ]};
    key <AD12> {    [      plus,    asterisk,  asciitilde,  macron      ]};
    key <AC10> {    [ odiaeresis,   Odiaeresis,  acute          ]};
    key <AC11> {    [ adiaeresis,   Adiaeresis,  asciicircum        ]};

    key <BKSL> {    [ numbersign,   apostrophe,  grave          ]};
};
2
  • If you show what you tried, someone may be able to help get it right. Jul 10, 2020 at 22:29
  • @GunnarHjalmarsson thanks for your remark I've updated the question to include more information on what I tried to do.
    – Gellweiler
    Jul 11, 2020 at 5:40

1 Answer 1

1

You edited the wrong file. Try to edit the basic German layout in /usr/share/X11/xkb/symbols/de instead.

It includes these two lines:

    key <AB01>  { [         y,          Y,       guillemotright,    U203A   ] };
    key <AB02>  { [         x,          X,        guillemotleft,    U2039   ] };

Change those to:

    key <AB01>  { [         y,          Y,       less,      guillemotright  ] };
    key <AB02>  { [         x,          X,       greater,   guillemotleft   ] };

The layout for German (Macintosh) (in the same file) includes German, so that ought to work.

1
  • Thanks a lot that worked!
    – Gellweiler
    Jul 13, 2020 at 7:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .