Last active
April 30, 2022 03:20
-
-
Save sam159247/590e96cd94825e798c64ea3d9ecadd86 to your computer and use it in GitHub Desktop.
[Karabiner-Elements] One key to change input source
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
{ | |
"title": "Language toggler", | |
"rules": [ | |
{ | |
"description": "left_shift=English, left_option=Shuangpin, right_command=Japanese, ecs=Reset_ime", | |
"manipulators": [ | |
{ | |
"type": "basic", | |
"from": { | |
"key_code": "left_shift", | |
"modifiers": { | |
"optional": ["any"] | |
} | |
}, | |
"parameters": { | |
"basic.to_if_held_down_threshold_milliseconds": 100 | |
}, | |
"to": [ | |
{ | |
"key_code": "left_shift", | |
"lazy": true | |
} | |
], | |
"to_if_held_down": [ | |
{ | |
"key_code": "left_shift" | |
} | |
], | |
"to_if_alone": [ | |
{ | |
"select_input_source": { | |
"input_source_id": "com.apple.keylayout.ABC" | |
} | |
} | |
] | |
}, | |
{ | |
"type": "basic", | |
"from": { | |
"key_code": "left_option", | |
"modifiers": { | |
"optional": ["any"] | |
} | |
}, | |
"parameters": { | |
"basic.to_if_held_down_threshold_milliseconds": 100 | |
}, | |
"to": [ | |
{ | |
"key_code": "left_option", | |
"lazy": true | |
} | |
], | |
"to_if_held_down": [ | |
{ | |
"key_code": "left_option" | |
} | |
], | |
"to_if_alone": [ | |
{ | |
"select_input_source": { | |
"input_mode_id": "com.apple.inputmethod.TCIM.Shuangpin", | |
"input_source_id": "com.apple.inputmethod.TCIM.Shuangpin", | |
"language": "zh-Hant" | |
} | |
} | |
] | |
}, | |
{ | |
"type": "basic", | |
"from": { | |
"key_code": "right_command", | |
"modifiers": { | |
"optional": ["any"] | |
} | |
}, | |
"parameters": { | |
"basic.to_if_held_down_threshold_milliseconds": 100 | |
}, | |
"to": [ | |
{ | |
"key_code": "right_command", | |
"lazy": true | |
} | |
], | |
"to_if_held_down": [ | |
{ | |
"key_code": "right_command" | |
} | |
], | |
"to_if_alone": [ | |
{ | |
"select_input_source": { | |
"input_mode_id": "com.apple.inputmethod.Japanese", | |
"input_source_id": "com.apple.inputmethod.Kotoeri.RomajiTyping.Japanese", | |
"language": "ja" | |
} | |
} | |
] | |
}, | |
{ | |
"type": "basic", | |
"from": { | |
"key_code": "escape", | |
"modifiers": { | |
"optional": ["any"] | |
} | |
}, | |
"parameters": { | |
"basic.to_if_held_down_threshold_milliseconds": 3000 | |
}, | |
"to": [ | |
{ | |
"key_code": "escape", | |
"lazy": true | |
} | |
], | |
"to_if_held_down": [ | |
{ | |
"shell_command": "pkill -u $(whoami) -f /usr/sbin/distnoted && pkill -u $(whoami) -if input" | |
} | |
] | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tips
~/.config/karabiner/assets/complex_modifications
Reference
https://gist.github.com/noma4i/91765f432f777c690aa3bddae37cfe3e
https://ke-complex-modifications.pqrs.org/#international
https://karabiner-elements.pqrs.org/docs/json/location/