Skip to content

Instantly share code, notes, and snippets.

@samholmes
Created June 2, 2018 04:50
Show Gist options
  • Save samholmes/375a5ebc96a6687a73aa767372675a1e to your computer and use it in GitHub Desktop.
Save samholmes/375a5ebc96a6687a73aa767372675a1e to your computer and use it in GitHub Desktop.
Karabiner-Elements Complex Modifications
{
"title": "Change caps_lock key",
"rules": [
{
"description": "Change caps_lock key to control. (Post escape key when pressed alone)",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_control"
}
],
"to_if_alone": [
{
"key_code": "escape"
}
]
}
]
},
{
"description": "Change caps_lock key to command+control+option+shift. (Post escape key when pressed alone)",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_shift",
"modifiers": [
"left_command",
"left_control",
"left_option"
]
}
],
"to_if_alone": [
{
"key_code": "escape"
}
]
}
]
},
{
"description": "Change caps_lock key to command+control+option+shift. (Use shift+caps_lock as caps_lock)",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "caps_lock",
"modifiers": {
"mandatory": [
"shift"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "caps_lock"
}
]
},
{
"type": "basic",
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_shift",
"modifiers": [
"left_command",
"left_control",
"left_option"
]
}
]
}
]
},
{
"description": "Change caps_lock to control if pressed with other keys, to escape if pressed alone.",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_control"
}
],
"to_if_alone": [
{
"key_code": "escape"
}
]
}
]
}
]
}
{
"title": "Change shift key",
"rules": [
{
"description": "Change left_shift to caps_lock if pressed alone",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "left_shift",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_shift"
}
],
"to_if_alone": [
{
"key_code": "caps_lock"
}
]
}
]
},
{
"description": "Change right_shift to caps_lock if pressed alone",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "right_shift",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "right_shift"
}
],
"to_if_alone": [
{
"key_code": "caps_lock"
}
]
}
]
},
{
"description": "Toggle caps_lock by pressing left_shift + right_shift at the same time",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "left_shift",
"modifiers": {
"mandatory": [
"right_shift"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "caps_lock"
}
],
"to_if_alone": [
{
"key_code": "left_shift"
}
]
},
{
"type": "basic",
"from": {
"key_code": "right_shift",
"modifiers": {
"mandatory": [
"left_shift"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "caps_lock"
}
],
"to_if_alone": [
{
"key_code": "right_shift"
}
]
}
]
},
{
"description": "Toggle caps_lock by pressing left_shift + right_shift at the same time and if pressed alone",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "left_shift",
"modifiers": {
"mandatory": [
"right_shift"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "left_shift"
}
],
"to_if_alone": [
{
"key_code": "caps_lock"
}
]
},
{
"type": "basic",
"from": {
"key_code": "right_shift",
"modifiers": {
"mandatory": [
"left_shift"
],
"optional": [
"caps_lock"
]
}
},
"to": [
{
"key_code": "right_shift"
}
],
"to_if_alone": [
{
"key_code": "caps_lock"
}
]
}
]
}
]
}

These are some of my custom complex modifications for Karabiner-Elements.

  1. Place these files in ~/.config/karabiner/assets/complex_modifications
  2. Add the preferred rules under the Complex Modifications tab in Karabiner-Elements Preference

My preference is to use the following rules:

  • "Change caps_lock to control if pressed with other keys, to escape if pressed alone."
  • "Toggle caps_lock by pressing left_shift + right_shift at the same time"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment