在 ubuntu 20 中修改键盘布局

在 ubuntu 20 中修改键盘布局

我的 hp 笔记本有一个德文键盘,似乎是美文键盘的复刻版。因此,它缺少<>|德文键盘上通常位于 l-shift 右侧的键。

这显然非常烦人,到目前为止,我还没有找到可以产生<或的替代键组合>。似乎有一种称为 E2 的键盘布局非常适合我的键盘(https://de.wikipedia.org/wiki/Tastaturbelegung#Tastaturbelegung_E2)。然而,Ubuntu 20 似乎并不支持它。

那么,有人知道如何获取 Linux 的 E2 布局或如何为<和创建替代键映射>吗?我在网上找到的有关如何自定义键盘布局的教程似乎已经过时了,我无法让它们在 Ubuntu 20 中工作。

以下是我尝试过的:

我尝试按照本教程https://help.ubuntu.com/community/Custom%20keyboard%20layout%20definitions

我尝试使用 xkb重新映射ALTGR-Y<ALTGR-X到。>

我目前正在使用键盘布局,German (Macinthosh)所以我编辑了该/usr/share/X11/xkb/symbols/macintosh_vndr/de文件。

在 xkb_symobls“基本”部分,我添加了以下映射:

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

然后我重新启动了但ALGR-Y仍然ALTGR-X显示错误的字符。:(

更多信息:

$ 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          ]};
};

答案1

您编辑了错误的文件。尝试编辑基本德语布局/usr/share/X11/xkb/symbols/de

它包含以下两行:

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

将其更改为:

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

布局德语(Macintosh)(在同一个文件中)包括德语,这样应该可以工作。

相关内容