Skip to content

Instantly share code, notes, and snippets.

@dstd
Last active March 2, 2026 21:19
Show Gist options
  • Select an option

  • Save dstd/0e8d8042fe0b20e7668c6fc8747109d3 to your computer and use it in GitHub Desktop.

Select an option

Save dstd/0e8d8042fe0b20e7668c6fc8747109d3 to your computer and use it in GitHub Desktop.
[karabiner] bunch of modifications for karabiner
{
"description": "Swap input source while capslock being held; capslock+left/right/up/down as home/end/pgup/pgdn; capslock+\\ as capslock",
"manipulators": [
{
"conditions": [{
"input_sources": [{ "language": "en" }],
"type": "input_source_if"
}],
"from": {
"key_code": "caps_lock",
"modifiers": { "optional": ["any"] }
},
"to": [
{ "select_input_source": { "language": "ru" } },
{ "set_variable": { "name": "caps_lock pressed", "value": 1 } }
],
"to_after_key_up": [
{ "select_input_source": { "language": "en" } },
{ "set_variable": { "name": "caps_lock pressed", "value": 0 } }
],
"type": "basic"
},
{
"conditions": [{
"input_sources": [{ "language": "ru" }],
"type": "input_source_if"
}],
"from": {
"key_code": "caps_lock",
"modifiers": { "optional": ["any"] }
},
"to": [
{ "select_input_source": { "language": "en" } },
{ "set_variable": { "name": "caps_lock pressed", "value": 1 } }
],
"to_after_key_up": [
{ "select_input_source": { "language": "ru" } },
{ "set_variable": { "name": "caps_lock pressed", "value": 0 } }
],
"type": "basic"
},
{
"type": "basic",
"conditions": [
{ "name": "caps_lock pressed", "type": "variable_if", "value": 1 }
],
"from": {
"key_code": "backslash",
"modifiers": { "optional": [ "any" ] }
},
"to": [
{ "key_code": "caps_lock" }
]
},
{
"type": "basic",
"conditions": [
{ "name": "caps_lock pressed", "type": "variable_if", "value": 1 }
],
"from": {
"key_code": "left_arrow",
"modifiers": { "optional": [ "any" ] }
},
"to": [
{ "key_code": "home" }
]
},
{
"type": "basic",
"conditions": [
{ "name": "caps_lock pressed", "type": "variable_if", "value": 1 }
],
"from": {
"key_code": "right_arrow",
"modifiers": { "optional": [ "any" ] }
},
"to": [
{ "key_code": "end" }
]
},
{
"type": "basic",
"conditions": [
{ "name": "caps_lock pressed", "type": "variable_if", "value": 1 }
],
"from": {
"key_code": "up_arrow",
"modifiers": { "optional": [ "any" ] }
},
"to": [
{ "key_code": "page_up" }
]
},
{
"type": "basic",
"conditions": [
{ "name": "caps_lock pressed", "type": "variable_if", "value": 1 }
],
"from": {
"key_code": "down_arrow",
"modifiers": { "optional": [ "any" ] }
},
"to": [
{ "key_code": "page_down" }
]
},
{
"type": "basic",
"conditions": [
{ "name": "caps_lock pressed", "type": "variable_if", "value": 1 }
],
"from": {
"key_code": "f1",
"modifiers": { "optional": [ "any" ] }
},
"to": [
{ "key_code": "display_brightness_decrement" }
]
},
{
"type": "basic",
"conditions": [
{ "name": "caps_lock pressed", "type": "variable_if", "value": 1 }
],
"from": {
"key_code": "f2",
"modifiers": { "optional": [ "any" ] }
},
"to": [
{ "key_code": "display_brightness_increment" }
]
},
{
"type": "basic",
"conditions": [
{ "name": "caps_lock pressed", "type": "variable_if", "value": 1 }
],
"from": {
"key_code": "f3",
"modifiers": { "optional": [ "any" ] }
},
"to": [
{ "key_code": "mission_control" }
]
},
{
"type": "basic",
"conditions": [
{ "name": "caps_lock pressed", "type": "variable_if", "value": 1 }
],
"from": {
"key_code": "f4",
"modifiers": { "optional": [ "any" ] }
},
"to": [
{ "key_code": "launchpad" }
]
},
{
"type": "basic",
"conditions": [
{ "name": "caps_lock pressed", "type": "variable_if", "value": 1 }
],
"from": {
"key_code": "f5",
"modifiers": { "optional": [ "any" ] }
},
"to": [
{ "key_code": "insert" }
]
},
{
"type": "basic",
"conditions": [
{ "name": "caps_lock pressed", "type": "variable_if", "value": 1 }
],
"from": {
"key_code": "f6",
"modifiers": { "optional": [ "any" ] }
},
"to": [
{ "apple_vendor_top_case_key_code": "illumination_up" }
]
},
{
"type": "basic",
"conditions": [
{ "name": "caps_lock pressed", "type": "variable_if", "value": 1 }
],
"from": {
"key_code": "f7",
"modifiers": { "optional": [ "any" ] }
},
"to": [
{ "consumer_key_code": "rewind" }
]
},
{
"type": "basic",
"conditions": [
{ "name": "caps_lock pressed", "type": "variable_if", "value": 1 }
],
"from": {
"key_code": "f8",
"modifiers": { "optional": [ "any" ] }
},
"to": [
{ "consumer_key_code": "play_or_pause" }
]
},
{
"type": "basic",
"conditions": [
{ "name": "caps_lock pressed", "type": "variable_if", "value": 1 }
],
"from": {
"key_code": "f9",
"modifiers": { "optional": [ "any" ] }
},
"to": [
{ "consumer_key_code": "fast_forward" }
]
},
{
"type": "basic",
"conditions": [
{ "name": "caps_lock pressed", "type": "variable_if", "value": 1 }
],
"from": {
"key_code": "f10",
"modifiers": { "optional": [ "any" ] }
},
"to": [
{ "consumer_key_code": "mute" }
]
},
{
"type": "basic",
"conditions": [
{ "name": "caps_lock pressed", "type": "variable_if", "value": 1 }
],
"from": {
"key_code": "f11",
"modifiers": { "optional": [ "any" ] }
},
"to": [
{ "consumer_key_code": "volume_decrement" }
]
},
{
"type": "basic",
"conditions": [
{ "name": "caps_lock pressed", "type": "variable_if", "value": 1 }
],
"from": {
"key_code": "f12",
"modifiers": { "optional": [ "any" ] }
},
"to": [
{ "consumer_key_code": "volume_increment" }
]
},
{
"type": "basic",
"conditions": [
{ "name": "caps_lock pressed", "type": "variable_if", "value": 1 }
],
"from": {
"key_code": "delete_or_backspace",
"modifiers": { "optional": [ "any" ] }
},
"to": [
{ "key_code": "delete_forward" }
]
}
]
}
{
"description": "Swap input source while CapsLock being held",
"enabled": false,
"manipulators": [
{
"conditions": [
{
"input_sources": [{ "language": "en" }],
"type": "input_source_if"
}
],
"from": {
"key_code": "caps_lock",
"modifiers": { "optional": ["any"] }
},
"to": [{ "select_input_source": { "language": "ru" } }],
"to_after_key_up": [{ "select_input_source": { "language": "en" } }],
"type": "basic"
},
{
"conditions": [
{
"input_sources": [{ "language": "ru" }],
"type": "input_source_if"
}
],
"from": {
"key_code": "caps_lock",
"modifiers": { "optional": ["any"] }
},
"to": [{ "select_input_source": { "language": "en" } }],
"to_after_key_up": [{ "select_input_source": { "language": "ru" } }],
"type": "basic"
}
]
}
{
"description": "\"option + tab\" act as \"control + tab\", optional shift.",
"manipulators": [
{
"conditions": [
{
"bundle_identifiers": [
"^com\\.google\\.android\\.studio$"
],
"type": "frontmost_application_unless"
}
],
"from": {
"key_code": "tab",
"modifiers": { "mandatory": ["option"] }
},
"to": [
{
"key_code": "tab",
"modifiers": ["control"]
}
],
"type": "basic"
},
{
"conditions": [
{
"bundle_identifiers": [
"^com\\.google\\.android\\.studio$"
],
"type": "frontmost_application_unless"
}
],
"from": {
"key_code": "tab",
"modifiers": { "mandatory": ["option", "shift"] }
},
"to": [
{
"key_code": "tab",
"modifiers": ["control", "shift"]
}
],
"type": "basic"
}
]
}
{
"description": "If pressed alone, CmdL for English, CmdR for Russian",
"manipulators": [
{
"from": {
"key_code": "left_command",
"modifiers": { "optional": ["any"] }
},
"to": { "key_code": "left_command" },
"to_if_alone": [{ "select_input_source": { "language": "en" } }],
"type": "basic"
},
{
"from": {
"key_code": "right_command",
"modifiers": { "optional": ["any"] }
},
"to": { "key_code": "right_command" },
"to_if_alone": [{ "select_input_source": { "language": "ru" } }],
"type": "basic"
}
]
}
{
"description": "Глобальный шорткат для лайка в ЯндексМузыка.app, через временное переключение",
"manipulators": [
{
"conditions": [
{
"bundle_identifiers": [
"^ru\\.yandex\\.desktop\\.music$"
],
"type": "frontmost_application_unless"
}
],
"from": {
"key_code": "f12",
"modifiers": { "mandatory": ["control"] }
},
"to": [{ "shell_command": "osascript -e 'tell application \"Яндекс Музыка\" to activate'" }],
"type": "basic"
},
{
"conditions": [
{
"bundle_identifiers": [
"^ru\\.yandex\\.desktop\\.music111$"
],
"type": "frontmost_application_if"
}
],
"from": {
"key_code": "f12",
"modifiers": { "mandatory": ["control"] }
},
"to": [{ "shell_command": "osascript -e 'tell application \"System Events\" to set frontmostApp to name of first process whose frontmost is true' -e 'if frontMostApp is \"Яндекс Музыка\" then' -e 'tell application \"System Events\" to key code 3' -e 'delay 0.25' -e ' tell application \"System Events\" to keystroke tab using {command down}' -e 'end if'" }],
"type": "basic"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment