13

Karabiner-Elements 自定义 shift 键位切换输入法

 3 years ago
source link: https://arminli.com/custom-karabiner-elements-shift/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Armin's Blog

Karabiner-Elements 自定义 shift 键位切换输入法

December 06, 2018

今天 MacOS 的最新版开始支持小鹤双拼,便转换到了系统默认的输入法。但是默认中文输入法切换英文状态的快捷键是大写键,而我已经将它映射到了 ESC 键,所以这篇文章将实现 单击 shift 切换输入法,长按 shift 不影响(比如 shift+a = A)。

我当前的切换输入法的快捷键是 left-control+space,因此只需要将单击 shift 映射到 left-control+space 即可。

进入 Karabiner-Elements -> Complex Modifications -> Add rule 会发现目前的高级配置只能导入,不能自定义编辑,因此我们直接编辑全局配置文件:vim ~/.config/karabiner/karabiner.json

在 complex_modifications 下 rules 字段替换为:

                "rules": [
                    {
                        "manipulators": [
                            {
                                "description": "Change left_shift to control+space when used alone",
                                "from": {
                                    "key_code": "left_shift",
                                    "modifiers": {
                                        "optional": [
                                            "any"
                                        ]
                                    }
                                },
                                "to_if_alone": [
                                    {
                                        "key_code": "spacebar",
                                        "modifiers": [
                                                "left_control"
                                        ]
                                    }
                                ],
                                "to": [
                                    {
                                        "key_code": "left_shift"
                                    }
                                ],
                                "type": "basic"
                            }
                        ]
                    }
                ]

保存后发现 GUI 中 Complex Modifications 中已经出现这个 rule 并且 enabled.


Profile picture

Written by Armin Li , a venture capitalist. [Weibo] [Subscribe]


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK