Skip to content

Instantly share code, notes, and snippets.

@cdpath
Created September 27, 2024 16:13
Show Gist options
  • Save cdpath/1dd129dbf4bbfcbc32bb1db27aec7a93 to your computer and use it in GitHub Desktop.
Save cdpath/1dd129dbf4bbfcbc32bb1db27aec7a93 to your computer and use it in GitHub Desktop.
Karabiner-Elements Config: shift for us shift-shift for rime
{
"description": "Use left Shift for English/Chinese input switching",
"manipulators": [
{
"conditions": [
{
"name": "left_shift_pressed",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "left_shift",
"modifiers": { "optional": ["any"] }
},
"to": [{ "select_input_source": { "input_mode_id": "im.rime.inputmethod.Squirrel.Hans" } }],
"type": "basic"
},
{
"from": {
"key_code": "left_shift",
"modifiers": { "optional": ["any"] }
},
"parameters": {
"basic.to_delayed_action_delay_milliseconds": 200,
"basic.to_if_alone_timeout_milliseconds": 200
},
"to": [
{
"set_variable": {
"name": "left_shift_pressed",
"value": 1
}
},
{ "key_code": "left_shift" }
],
"to_delayed_action": {
"to_if_canceled": [
{
"set_variable": {
"name": "left_shift_pressed",
"value": 0
}
}
],
"to_if_invoked": [
{
"set_variable": {
"name": "left_shift_pressed",
"value": 0
}
}
]
},
"to_if_alone": [{ "select_input_source": { "language": "en" } }],
"type": "basic"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment