Created
August 5, 2023 01:26
-
-
Save oneleo/434fe80e522b9b6dc8ae584844554f95 to your computer and use it in GitHub Desktop.
karabiner-elements: perfect solution while changing language inputs between EN and ZH (Location: ${HOME}/.config/karabiner/assets/complex_modifications/)
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": "LR_Shift to Ctrl+Space", | |
"rules": [ | |
{ | |
"description": "Change L_Shift to switch EN/ZH condition", | |
"manipulators": [ | |
{ | |
"type": "basic", | |
"conditions": [ | |
{ | |
"input_sources": [ | |
{ | |
"input_source_id": "^com\\.apple\\.keylayout\\.ABC$", | |
"language": "en*" | |
} | |
], | |
"type": "input_source_unless" | |
} | |
], | |
"from": { | |
"key_code": "left_shift", | |
"modifiers": { | |
"optional": ["any"] | |
} | |
}, | |
"parameters": { | |
"basic.to_if_alone_timeout_milliseconds": 333, | |
"basic.to_if_held_down_threshold_milliseconds": 333 | |
}, | |
"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$", | |
"language": "en*" | |
} | |
} | |
] | |
}, | |
{ | |
"type": "basic", | |
"conditions": [ | |
{ | |
"input_sources": [ | |
{ | |
"input_source_id": "^com\\.boshiamy\\.inputmethod\\.BoshiamyIMK$", | |
"language": "zh*" | |
} | |
], | |
"type": "input_source_unless" | |
} | |
], | |
"from": { | |
"key_code": "left_shift", | |
"modifiers": { | |
"optional": ["any"] | |
} | |
}, | |
"parameters": { | |
"basic.to_if_alone_timeout_milliseconds": 333, | |
"basic.to_if_held_down_threshold_milliseconds": 333 | |
}, | |
"to": [ | |
{ | |
"key_code": "left_shift", | |
"lazy": true | |
} | |
], | |
"to_if_held_down": [ | |
{ | |
"key_code": "left_shift" | |
} | |
], | |
"to_if_alone": [ | |
{ | |
"key_code": "spacebar", | |
"modifiers": ["left_control", "left_option"], | |
"hold_down_milliseconds": 1 | |
} | |
] | |
} | |
] | |
}, | |
{ | |
"description": "Change R_Shift to switch EN/ZH condition", | |
"manipulators": [ | |
{ | |
"type": "basic", | |
"conditions": [ | |
{ | |
"input_sources": [ | |
{ | |
"input_source_id": "^com\\.apple\\.keylayout\\.ABC$", | |
"language": "en*" | |
} | |
], | |
"type": "input_source_unless" | |
} | |
], | |
"from": { | |
"key_code": "right_shift", | |
"modifiers": { | |
"optional": ["any"] | |
} | |
}, | |
"parameters": { | |
"basic.to_if_alone_timeout_milliseconds": 333, | |
"basic.to_if_held_down_threshold_milliseconds": 333 | |
}, | |
"to": [ | |
{ | |
"key_code": "right_shift", | |
"lazy": true | |
} | |
], | |
"to_if_held_down": [ | |
{ | |
"key_code": "right_shift" | |
} | |
], | |
"to_if_alone": [ | |
{ | |
"select_input_source": { | |
"input_source_id": "^com\\.apple\\.keylayout\\.ABC$", | |
"language": "en*" | |
} | |
} | |
] | |
}, | |
{ | |
"type": "basic", | |
"conditions": [ | |
{ | |
"input_sources": [ | |
{ | |
"input_source_id": "^com\\.boshiamy\\.inputmethod\\.BoshiamyIMK$", | |
"language": "zh*" | |
} | |
], | |
"type": "input_source_unless" | |
} | |
], | |
"from": { | |
"key_code": "right_shift", | |
"modifiers": { | |
"optional": ["any"] | |
} | |
}, | |
"parameters": { | |
"basic.to_if_alone_timeout_milliseconds": 333, | |
"basic.to_if_held_down_threshold_milliseconds": 333 | |
}, | |
"to": [ | |
{ | |
"key_code": "right_shift", | |
"lazy": true | |
} | |
], | |
"to_if_held_down": [ | |
{ | |
"key_code": "right_shift" | |
} | |
], | |
"to_if_alone": [ | |
{ | |
"key_code": "spacebar", | |
"modifiers": ["right_control", "right_option"], | |
"hold_down_milliseconds": 1 | |
} | |
] | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment