需要帮助将 Xmodmap 转换为 XKB

需要帮助将 Xmodmap 转换为 XKB

我已经使用这个 .Xmodmap 好几年了,但是现在我要切换到 Wayland,我需要替换它:

!remove Lock = Caps_Lock

keycode  66 = Mode_switch
keycode 108 = Mode_switch

keycode  26 = e E EuroSign cent
keycode  30 = u U udiaeresis Udiaeresis
keycode  32 = o O odiaeresis Odiaeresis
keycode  38 = a A adiaeresis Adiaeresis
keycode  39 = s S ssharp

上面的 .Xmodmap 禁用 Caps-Lock,例如按 Caps-Lock + u 会显示 ü。它是

我尝试过自己做,但结果却不行:(

partial modifier_keys
xkb_symbols "caps_lock" {
    key <CAPS> {
        type[Group1] = "MODIFIER_LOCK",
        modifiers = "Control",
        control = "Control_L",
        lock = "Caps Lock"
    };
};

partial keys
xkb_symbols "my_layout" {
    key <AE01> { [ e, E, EuroSign, cent ] };
    key <AE02> { [ u, U, udiaeresis, Udiaeresis ] };
    key <AE03> { [ o, O, odiaeresis, Odiaeresis ] };
    key <AE04> { [ a, A, adiaeresis, Adiaeresis ] };
    key <AE05> { [ s, S, ssharp ] };
};


partial xkb_layouts "my_layout" {
    xkb_symbols "default" {
        include "us"
        include "caps_lock"
        include "keys(my_layout)"
    };
};

有人能给我指明正确的方向吗?

答案1

==> ~/.config/xkb/symbols/b <==
partial alphanumeric_keys modifier_keys keypad_keys
xkb_symbols "b" {
    key <AE01> { [ e, E, EuroSign, cent ] };
};
==> ~/.config/xkb/main <==
/* Replace de by your language keyboard code. */
xkb_keymap {
  xkb_keycodes{include "evdev+aliases(qwerty)"};
  xkb_types   {include "complete"};
  xkb_compat  {include "complete"};
  xkb_symbols {include "pc+de+inet(evdev)+level3(caps_switch)+b(b)"};
  xkb_geometry{include "pc(pc105)"};
};

启动时,

xkbcomp -I"$HOME/.config/xkb" "$HOME/.config/xkb/main" "$DISPLAY" &

相关内容