在Karabiner中,我可以从包含所有修饰符的超键映射到修饰键吗?

时间:2018-12-27 20:10:01

标签: macos karabiner

我将我的 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 and End, Command + 左/右,如下所示:

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

但这不起作用。是因为我不能再将映射到修改过的键,因为超键设置已经“消耗”了所有修改键?或者是其他东西?有办法使它起作用吗?


附录: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 个答案:

答案 0 :(得分:1)

好,知道了。这是我做错了/我的误解:

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

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