Skip to content

Instantly share code, notes, and snippets.

@jungin500
Last active April 13, 2023 04:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jungin500/6025571ae9d61bb47050343e45c1fdd1 to your computer and use it in GitHub Desktop.
Save jungin500/6025571ae9d61bb47050343e45c1fdd1 to your computer and use it in GitHub Desktop.
[Karabiner][V13] left_shift twice to toggle between Control <=> Command - https://dailylime.kr/898/
{
"title": "[V13] left_shift twice to toggle between Control <=> Command",
"rules": [
{
"description": "Press left_shift twice to toggle between Control and Command key. Another key pressed during each left_shift press will be considered as a cancel, and timeout will also considered as cancel.",
"manipulators": [
{
"conditions": [
{
"type": "variable_if",
"name": "left_shift toggled",
"value": 1
}
],
"type": "basic",
"from": {
"key_code": "left_control",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_command"
}
]
},
{
"conditions": [
{
"type": "variable_if",
"name": "left_shift toggled",
"value": 3
}
],
"type": "basic",
"from": {
"key_code": "left_control",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_command"
}
]
},
{
"conditions": [
{
"type": "variable_if",
"name": "left_shift toggled",
"value": 1
}
],
"type": "basic",
"from": {
"key_code": "left_command",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_control"
}
]
},
{
"conditions": [
{
"type": "variable_if",
"name": "left_shift toggled",
"value": 3
}
],
"type": "basic",
"from": {
"key_code": "left_command",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_control"
}
]
},
{
"conditions": [
{
"type": "variable_if",
"name": "left_shift toggled",
"value": 0
}
],
"type": "basic",
"from": {
"key_code": "left_shift"
},
"to": [
{
"key_code": "left_shift"
}
],
"to_if_alone": [
{
"set_variable": {
"name": "left_shift toggled",
"value": 2
}
}
],
"to_delayed_action": {
"to_if_invoked": [
{
"set_variable": {
"name": "left_shift toggled",
"value": 0
}
}
]
}
},
{
"conditions": [
{
"type": "variable_if",
"name": "left_shift toggled",
"value": 2
}
],
"type": "basic",
"from": {
"key_code": "left_shift"
},
"to": [
{
"set_variable": {
"name": "left_shift toggled",
"value": 0
}
}
],
"to_if_alone": [
{
"set_variable": {
"name": "left_shift toggled",
"value": 1
}
}
]
},
{
"conditions": [
{
"type": "variable_if",
"name": "left_shift toggled",
"value": 1
}
],
"type": "basic",
"from": {
"key_code": "left_shift"
},
"to": [
{
"key_code": "left_shift"
}
],
"to_if_alone": [
{
"set_variable": {
"name": "left_shift toggled",
"value": 3
}
}
],
"to_delayed_action": {
"to_if_invoked": [
{
"set_variable": {
"name": "left_shift toggled",
"value": 1
}
}
]
}
},
{
"conditions": [
{
"type": "variable_if",
"name": "left_shift toggled",
"value": 3
}
],
"type": "basic",
"from": {
"key_code": "left_shift"
},
"to": [
{
"set_variable": {
"name": "left_shift toggled",
"value": 1
}
}
],
"to_if_alone": [
{
"set_variable": {
"name": "left_shift toggled",
"value": 0
}
}
]
}
]
}
]
}
@jungin500
Copy link
Author

L7~L98: Swaps Control <-> Command depends on variable
L99~L228: Toggles variable on key pressed twice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment