0

在 Karabiner 上,我在其复杂的修改设置下启用了多个规则,例如Emacs key bindings.

我想知道是否可以仅将这些启用规则用于特定的键盘布局,例如U.S.当我切换到另一个键盘布局时自动禁用这些规则。

4

2 回答 2

0

无法将现有的导入规则变成特定于设备的规则。但是,如果您制定或修改这些规则,则可以。

https://pqrs.org/osx/karabiner/json.html#condition-definition-device

如何制定自己的规则的要点是在里面制作一个 json 文件

~/.config/karabiner/assets/complex_modifications/

您可以随意命名 json 文件。如果您愿意,您甚至可以从另一个地方对其进行符号链接。

因此,如果您有一个规则要指定设备,请将其复制粘贴到您的 json 文件中,并将其从type: "basic"to修改type: "device_if"并填写您的设备 ID 等,您可以从设备选项卡下的 Karabiner EventViewer 应用程序中获取这些信息。

于 2020-02-20T22:44:12.900 回答
0

从本指南

查看device_if 示例条件文档


我将以下代码添加到~/.config/karabiner/karabiner.json

{
    "manipulators": [
        {
            "conditions": [
                {
                    "input_sources": [
                        {
                            "language": "en"
                        }
                    ],
                    "type": "input_source_if"
                }
            ],

            "from": {
                "key_code": "open_bracket"
            },
            "to": [
                {
                    "key_code": "open_bracket",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "input_sources": [
                        {
                            "language": "en"
                        }
                    ],
                    "type": "input_source_if"
                }
            ],
            "from": {
                "key_code": "close_bracket",
                "modifiers": {
                    "mandatory": [
                        "left_shift"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "close_bracket"
                }
            ],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "input_sources": [
                        {
                            "language": "en"
                        }
                    ],
                    "type": "input_source_if"
                }
            ],
            "from": {
                "key_code": "close_bracket"
            },
            "to": [
                {
                    "key_code": "close_bracket",
                    "modifiers": [
                        "left_shift"
                    ]
                }
            ],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "input_sources": [
                        {
                            "language": "en"
                        }
                    ],
                    "type": "input_source_if"
                }
            ],
            "from": {
                "key_code": "open_bracket",
                "modifiers": {
                    "mandatory": [
                        "left_shift"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "open_bracket"
                }
            ],
            "type": "basic"
        }
    ]
    }
},
于 2020-05-12T23:18:48.020 回答