Created
May 19, 2019 05:22
-
-
Save gxfxyz/e5f2ac1ce4f5053e9fb6608c10609837 to your computer and use it in GitHub Desktop.
Karabiner-Elements config: switch input source | 输入法切换
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "title": "Switch input source | 输入法切换", | |
| "rules": [ | |
| { | |
| "description": "Tap Command_L (⌘) → Switch input source to English | 短按左 Command (⌘) → 切换到英文输入法", | |
| "manipulators": [ | |
| { | |
| "conditions": [ | |
| { | |
| "input_sources": [ | |
| { | |
| "language": "en" | |
| } | |
| ], | |
| "type": "input_source_unless" | |
| } | |
| ], | |
| "from": { | |
| "key_code": "left_command", | |
| "modifiers": { | |
| "optional": [ | |
| "caps_lock" | |
| ] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "key_code": "left_command", | |
| "lazy": true | |
| } | |
| ], | |
| "to_if_alone": [ | |
| { | |
| "key_code": "f18" | |
| } | |
| ], | |
| "to_if_held_down": [ | |
| { | |
| "key_code": "left_command" | |
| } | |
| ], | |
| "type": "basic" | |
| }, | |
| { | |
| "conditions": [ | |
| { | |
| "input_sources": [ | |
| { | |
| "language": "en" | |
| } | |
| ], | |
| "type": "input_source_if" | |
| } | |
| ], | |
| "from": { | |
| "key_code": "left_command", | |
| "modifiers": { | |
| "optional": [ | |
| "caps_lock" | |
| ] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "key_code": "left_command", | |
| "lazy": true | |
| } | |
| ], | |
| "to_if_alone": [ | |
| { | |
| "key_code": "vk_none" | |
| } | |
| ], | |
| "to_if_held_down": [ | |
| { | |
| "key_code": "left_command" | |
| } | |
| ], | |
| "type": "basic" | |
| } | |
| ] | |
| }, | |
| { | |
| "description": "Tap Command_R (⌘) → Switch input source to Chinese | 短按右 Command (⌘) → 切换到中文输入法", | |
| "manipulators": [ | |
| { | |
| "conditions": [ | |
| { | |
| "input_sources": [ | |
| { | |
| "language": "zh-Hans" | |
| } | |
| ], | |
| "type": "input_source_unless" | |
| } | |
| ], | |
| "from": { | |
| "key_code": "right_command", | |
| "modifiers": { | |
| "optional": [ | |
| "caps_lock" | |
| ] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "key_code": "right_command", | |
| "lazy": true | |
| } | |
| ], | |
| "to_if_alone": [ | |
| { | |
| "key_code": "f18" | |
| } | |
| ], | |
| "to_if_held_down": [ | |
| { | |
| "key_code": "right_command" | |
| } | |
| ], | |
| "type": "basic" | |
| }, | |
| { | |
| "conditions": [ | |
| { | |
| "input_sources": [ | |
| { | |
| "language": "zh-Hans" | |
| } | |
| ], | |
| "type": "input_source_if" | |
| } | |
| ], | |
| "from": { | |
| "key_code": "right_command", | |
| "modifiers": { | |
| "optional": [ | |
| "caps_lock" | |
| ] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "key_code": "right_command", | |
| "lazy": true | |
| } | |
| ], | |
| "to_if_alone": [ | |
| { | |
| "key_code": "vk_none" | |
| } | |
| ], | |
| "to_if_held_down": [ | |
| { | |
| "key_code": "right_command" | |
| } | |
| ], | |
| "type": "basic" | |
| } | |
| ] | |
| }, | |
| { | |
| "description": "Tap Shift_L (⇧) → Switch input source (F18) | 短按左 Shift (⇧) → 切换输入法", | |
| "manipulators": [ | |
| { | |
| "from": { | |
| "key_code": "left_shift", | |
| "modifiers": { | |
| "optional": [ | |
| "caps_lock" | |
| ] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "key_code": "left_shift" | |
| } | |
| ], | |
| "to_if_alone": [ | |
| { | |
| "key_code": "f18" | |
| } | |
| ], | |
| "to_if_held_down": [ | |
| { | |
| "key_code": "left_shift" | |
| } | |
| ], | |
| "type": "basic" | |
| } | |
| ] | |
| }, | |
| { | |
| "description": "Tap Shift_R (⇧) → Switch input source (F18) | 短按右 Shift (⇧) → 切换输入法", | |
| "manipulators": [ | |
| { | |
| "from": { | |
| "key_code": "right_shift", | |
| "modifiers": { | |
| "optional": [ | |
| "caps_lock" | |
| ] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "key_code": "right_shift" | |
| } | |
| ], | |
| "to_if_alone": [ | |
| { | |
| "key_code": "f18" | |
| } | |
| ], | |
| "to_if_held_down": [ | |
| { | |
| "key_code": "right_shift" | |
| } | |
| ], | |
| "type": "basic" | |
| } | |
| ] | |
| }, | |
| { | |
| "description": "Command_L (⌘) + Space → Switch input source (F18) | 左 Command (⌘) + 空格 → 切换输入法", | |
| "manipulators": [ | |
| { | |
| "from": { | |
| "key_code": "spacebar", | |
| "modifiers": { | |
| "mandatory": [ | |
| "left_command" | |
| ], | |
| "optional": [ | |
| "caps_lock" | |
| ] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "key_code": "f18" | |
| } | |
| ], | |
| "type": "basic" | |
| } | |
| ] | |
| }, | |
| { | |
| "description": "Command_R (⌘) + Space → Switch input source (F18) | 右 Command (⌘) + 空格 → 切换输入法", | |
| "manipulators": [ | |
| { | |
| "from": { | |
| "key_code": "spacebar", | |
| "modifiers": { | |
| "mandatory": [ | |
| "right_command" | |
| ], | |
| "optional": [ | |
| "caps_lock" | |
| ] | |
| } | |
| }, | |
| "to": [ | |
| { | |
| "key_code": "f18" | |
| } | |
| ], | |
| "type": "basic" | |
| } | |
| ] | |
| } | |
| ] | |
| } |
Author
新版kb有点不兼容左control大写,希望测试一下
新版kb有点不兼容左control大写,希望测试一下
@llity
可以调整一下规则的顺序,先把ctrl映射到caps, 再把caps映射到escape和control
@gxfxyz 转眼间就到2025年了,这个脚本陪我走过了好几个冬夏,但是现在macOS26不好用了,我大概测试了一下,现在需要改为按两次f18,才能精准切换输入法,
不知道是哪里的问题,大佬可以修复一下么? 非常感谢
"to_if_alone": [
{
"key_code": "f18"
},
{
"key_code": "f18"
}
]
Author
@gxfxyz 转眼间就到2025年了,这个脚本陪我走过了好几个冬夏,但是现在macOS26不好用了,我大概测试了一下,现在需要改为按两次f18,才能精准切换输入法, 不知道是哪里的问题,大佬可以修复一下么? 非常感谢
"to_if_alone": [ { "key_code": "f18" }, { "key_code": "f18" } ]
@chenchenfang 不好意思,我还在用旧版本的 macOS,近期比较忙,我可能得过一段时间有空了再升级一下系统看看能不能修复。
"to_if_alone": [
{
"hold_down_milliseconds": 10,
"key_code": "f18"
}
],
增加了10毫秒down up的间隔,可以正常使用了
@chenchenfang 我也碰到相同的问题了, 多谢
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@BitionSong 可以的,以左 Command (⌘) 为例,主要就是修改 32-36 行 为你想要的快捷键,然后去除 8-17 行的条件规则。
具体请自行参考 Karabiner-Elements 的文档和规则样例:
https://pqrs.org/osx/karabiner/document.html
https://ke-complex-modifications.pqrs.org