组合键到单个键的系统范围映射

组合键到单个键的系统范围映射

我最近从 macOS 切换到 Fedora,在 macOS 上我使用了一个名为 Karabiner Elements 的工具来映射按键组合

Ctrl+ö[
Ctrl+ä]
Alt+ö{
Alt+ä}

我知道这里有一个类似的问题:

我尝试根据我的情况调整该解决方案。到目前为止我已经得到了3个文件

.xkb/types/mytypes:

partial xkb_types "lock_level2" {
    Virtual_modifiers Lock;
    type "Lock_LEVEL2" {
        modifiers= Lock;
        map[Lock]= Level2;
        level_name[Level1]= "Base";
        level_name[Level2]= "Lock";
    };
};

partial xkb_types "alt_level2" {
    Virtual_modifiers Alt;
    type "ALT_LEVEL2" {
        modifiers= Alt;
        map[Alt]= Level2;
        level_name[Level1]= "Base";
        level_name[Level2]= "Alt";
    };
};

.xkb/symbols/mysymbols:

partial modifier_keys
xkb_symbols "Lock_brackets" {
    key <AC10>  {
        type[Group1] = "LOCK_LEVEL2",
        symbols[Group1] = [    Odiaeresis,   bracketleft      ]
    };
    key <AC11>  {
        type[Group1] = "LOCK_LEVEL2",
        symbols[Group1] = [    Adiaeresis,  bracketright       ]
    };
};

partial modifier_keys
xkb_symbols "alt_brackets" {
    key <AC10>  {
        type[Group1] = "ALT_LEVEL2",
        symbols[Group1] = [    Odiaeresis,   braceleft      ]
    };
    key <AC11>  {
        type[Group1] = "ALT_LEVEL2",
        symbols[Group1] = [    Adiaeresis,  braceright       ]
    };
};

.xkb/keymap/mykdb:

xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)" };
    xkb_types     { include "complete+mytypes(lock_level2)+mytypes(alt_level2)" };
    xkb_compat    { include "complete"  };
    xkb_symbols   { include "pc+de+inet(evdev)+mysymbols(lock_brackets)+mysymbols(alt_brackets)"    };
    xkb_geometry  { include "pc(pc105)" };
};

然后运行xkbcomp -I$HOME/.xkb ~/.xkb/keymap/mykbd $DISPLAY

但这似乎不适用于Alt和修饰符,但当我使用(而不是)Control时确实有效,然后它仅适用于 Sublime 和 Firefox,但不适用于 Gnome 和终端。ShiftControl

所以我想知道当前配置有什么问题以及如何为所有应用程序设置系统范围内的映射。

相关内容