在 Karabiner 中,我可以从由所有修饰符组成的超键映射到修改后的键吗?

In Karabiner, can I map to a modified key from a hyperkey that is comprised of all modifiers?

我将 CapsLock 映射为超级键。 (如果需要,请参阅问题底部的配置。)

我知道它有效,因为我已经成功地将 HyperKey+h / j / k / l 映射到箭头,vi-风格。以下是其中一个键的配置方式,例如:

    {
      "type": "basic",
      "from": {
        "key_code": "k",
        "modifiers": {
          "mandatory": [
            "left_shift",
            "control",
            "option",
            "command"
          ],
          "optional": [
            "any"
          ]
        }
      },
      "to": [
        {
          "key_code": "up_arrow"
        }
      ]
    },

但现在我正尝试将这样的组合映射到带有修饰符的箭头例如 HyperKey +g / ; 到 Home 和 End, Command+左/右,像这样:

    {
      "type": "basic",
      "from": {
        "key_code": "g",
        "modifiers": {
          "mandatory": [
            "left_shift",
            "control",
            "option",
            "command"
          ],
          "optional": [
            "any"
          ]
        }
      },
      "to": [
        {
          "key_code": "left_arrow",
          "modifiers": ["command"]
        }
      ]
    },

但这不起作用。是不是我不能再将 映射到 修改键,因为超键设置已经 "consumes" 所有修改键?或者是其他东西?有没有办法让它发挥作用?


附录:karabiner.json

中的 HyperKey 设置

这是从另一个资源复制的,我已经让它工作了。这仅供参考,以防需要查看超级密钥设置的详细信息。

"profiles": [
    {
        "complex_modifications": {
            "parameters": {
                "basic.simultaneous_threshold_milliseconds": 50,
                "basic.to_delayed_action_delay_milliseconds": 500,
                "basic.to_if_alone_timeout_milliseconds": 1000,
                "basic.to_if_held_down_threshold_milliseconds": 500
            },
            "rules": [
                {
                    "manipulators": [
                        {
                            "description": "Change caps_lock to command+control+option+shift.",
                            "from": {
                                "key_code": "caps_lock",
                                "modifiers": {
                                    "optional": [
                                        "any"
                                    ]
                                }
                            },
                            "to": [
                                {
                                    "key_code": "left_shift",
                                    "modifiers": [
                                        "left_command",
                                        "left_control",
                                        "left_option"
                                    ]
                                }
                            ],
                            "to_if_alone": [
                                {
                                    "key_code": "escape",
                                    "modifiers": {
                                        "optional": [
                                            "any"
                                        ]
                                    }
                                }
                            ],
                            "type": "basic"
                        }
                    ]
                },
                {
                    "description": "Change fn + hjkl' to arrow keys",
                    "manipulators": [
                        {
                            "from": {
                                "key_code": "k",
                                "modifiers": {
                                    "mandatory": [
                                        "left_shift",
                                        "control",
                                        "option",
                                        "command"
                                    ],
                                    "optional": [
                                        "any"
                                    ]
                                }
                            },
                            "to": [
                                {
                                    "key_code": "up_arrow"
                                }
                            ],
                            "type": "basic"
                        },
                        {
                            "from": {
                                "key_code": "h",
                                "modifiers": {
                                    "mandatory": [
                                        "left_shift",
                                        "control",
                                        "option",
                                        "command"
                                    ],
                                    "optional": [
                                        "any"
                                    ]
                                }
                            },
                            "to": [
                                {
                                    "key_code": "left_arrow"
                                }
                            ],
                            "type": "basic"
                        },
                        {
                            "from": {
                                "key_code": "j",
                                "modifiers": {
                                    "mandatory": [
                                        "left_shift",
                                        "control",
                                        "option",
                                        "command"
                                    ],
                                    "optional": [
                                        "any"
                                    ]
                                }
                            },
                            "to": [
                                {
                                    "key_code": "down_arrow"
                                }
                            ],
                            "type": "basic"
                        },
                        {
                            "from": {
                                "key_code": "l",
                                "modifiers": {
                                    "mandatory": [
                                        "left_shift",
                                        "control",
                                        "option",
                                        "command"
                                    ],
                                    "optional": [
                                        "any"
                                    ]
                                }
                            },
                            "to": [
                                {
                                    "key_code": "right_arrow"
                                }
                            ],
                            "type": "basic"
                        }
                    ]
                }
            ]
        },
        "devices": [
            {
                "disable_built_in_keyboard_if_exists": false,
                "fn_function_keys": [],
                "identifiers": {
                    "is_keyboard": true,
                    "is_pointing_device": false,
                    "product_id": 610,
                    "vendor_id": 1452
                },
                "ignore": false,
                "manipulate_caps_lock_led": true,
                "simple_modifications": []
            },
            {
                "disable_built_in_keyboard_if_exists": false,
                "fn_function_keys": [],
                "identifiers": {
                    "is_keyboard": true,
                    "is_pointing_device": false,
                    "product_id": 597,
                    "vendor_id": 1452
                },
                "ignore": false,
                "manipulate_caps_lock_led": true,
                "simple_modifications": []
            }
        ],
        "fn_function_keys": [
            {
                "from": {
                    "key_code": "f1"
                },
                "to": {
                    "key_code": "vk_consumer_brightness_down"
                }
            },
            {
                "from": {
                    "key_code": "f2"
                },
                "to": {
                    "key_code": "vk_consumer_brightness_up"
                }
            },
            {
                "from": {
                    "key_code": "f3"
                },
                "to": {
                    "key_code": "vk_mission_control"
                }
            },
            {
                "from": {
                    "key_code": "f4"
                },
                "to": {
                    "key_code": "vk_launchpad"
                }
            },
            {
                "from": {
                    "key_code": "f5"
                },
                "to": {
                    "key_code": "vk_consumer_illumination_down"
                }
            },
            {
                "from": {
                    "key_code": "f6"
                },
                "to": {
                    "key_code": "vk_consumer_illumination_up"
                }
            },
            {
                "from": {
                    "key_code": "f7"
                },
                "to": {
                    "key_code": "vk_consumer_previous"
                }
            },
            {
                "from": {
                    "key_code": "f8"
                },
                "to": {
                    "key_code": "vk_consumer_play"
                }
            },
            {
                "from": {
                    "key_code": "f9"
                },
                "to": {
                    "key_code": "vk_consumer_next"
                }
            },
            {
                "from": {
                    "key_code": "f10"
                },
                "to": {
                    "key_code": "mute"
                }
            },
            {
                "from": {
                    "key_code": "f11"
                },
                "to": {
                    "key_code": "volume_down"
                }
            },
            {
                "from": {
                    "key_code": "f12"
                },
                "to": {
                    "key_code": "volume_up"
                }
            }
        ],
        "name": "Default profile",
        "one_to_many_mappings": {},
        "selected": true,
        "simple_modifications": [],
        "standalone_keys": {},
        "virtual_hid_keyboard": {
            "caps_lock_delay_milliseconds": 0,
            "country_code": 0,
            "keyboard_type": "ansi",
            "standalone_keys_delay_milliseconds": 200
        }
    },

好的,明白了。这是我做错了什么/我的误解:

  1. 我不确定为什么 karabiner.json 和 assets/complex_modifications/my_mappings.json 中都存在映射。重要的是后者。当您重新加载 Karabiner 时,它似乎将这些映射复制到 karabiner.json.

  2. 我必须使用 semicolon 进行映射,而不是 ;