Created
March 3, 2024 14:59
-
-
Save nzooherd/9e83731c70ba68f87d8c58f267ccae19 to your computer and use it in GitHub Desktop.
Mac 利用 shift 快速切换 中,英,日三种语言 Karabiner 配置
This file contains 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
{ | |
"description": "left shift switch input between zh-Hans and !zh-Hans, right shift switch input between ja and !ja", | |
"manipulators": [ | |
{ | |
"conditions": [ | |
{ | |
"input_sources": [ | |
{ | |
"language": "zh-Hans" | |
} | |
], | |
"type": "input_source_unless" | |
} | |
], | |
"from": { | |
"key_code": "left_shift" | |
}, | |
"parameters": { | |
"basic.to_if_alone_timeout_milliseconds": 200, | |
"basic.to_if_held_down_threshold_milliseconds": 200 | |
}, | |
"to": [ | |
{ | |
"key_code": "left_shift", | |
"lazy": true | |
} | |
], | |
"to_if_alone": [ | |
{ | |
"select_input_source": { | |
"language": "zh-Hans" | |
} | |
} | |
], | |
"to_if_held_down": [ | |
{ | |
"key_code": "left_shift" | |
} | |
], | |
"type": "basic" | |
}, | |
{ | |
"conditions": [ | |
{ | |
"input_sources": [ | |
{ | |
"language": "zh-Hans" | |
} | |
], | |
"type": "input_source_if" | |
} | |
], | |
"from": { | |
"key_code": "left_shift" | |
}, | |
"parameters": { | |
"basic.to_if_alone_timeout_milliseconds": 200, | |
"basic.to_if_held_down_threshold_milliseconds": 200 | |
}, | |
"to": [ | |
{ | |
"key_code": "left_shift", | |
"lazy": true | |
} | |
], | |
"to_if_alone": [ | |
{ | |
"select_input_source": { | |
"language": "en" | |
} | |
} | |
], | |
"to_if_held_down": [ | |
{ | |
"key_code": "left_shift" | |
} | |
], | |
"type": "basic" | |
}, | |
{ | |
"conditions": [ | |
{ | |
"input_sources": [ | |
{ | |
"language": "ja" | |
} | |
], | |
"type": "input_source_if" | |
} | |
], | |
"from": { | |
"key_code": "right_shift" | |
}, | |
"to_if_alone": [ | |
{ | |
"select_input_source": { | |
"language": "en" | |
} | |
} | |
], | |
"type": "basic" | |
}, | |
{ | |
"conditions": [ | |
{ | |
"input_sources": [ | |
{ | |
"language": "ja" | |
} | |
], | |
"type": "input_source_unless" | |
} | |
], | |
"from": { | |
"key_code": "right_shift" | |
}, | |
"to_if_alone": [ | |
{ | |
"select_input_source": { | |
"input_source_id": "com.apple.inputmethod.Kotoeri.RomajiTyping.Japanese", | |
"language": "ja" | |
} | |
} | |
], | |
"type": "basic" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
由于 TISSelectInputSource 的陈年 Bug, 这种方式可能切换输入法失败。
最新代码如下,利用 Option+Control+Space 的系统快捷键。左 shift 切换中文输入法,右 shift 切换日文输入法。可能需要手动调整下顺序。