Skip to content

Instantly share code, notes, and snippets.

@xerial
Last active April 28, 2022 18:44
Show Gist options
  • Save xerial/451e33b021bf7c68975e049ff30a13a4 to your computer and use it in GitHub Desktop.
Save xerial/451e33b021bf7c68975e049ff30a13a4 to your computer and use it in GitHub Desktop.
Karabinar Settings
{
"title": "i/k/k/l Arrows Layer",
"rules": [
{
"description": "Enter i/j/k/l arrow mode with left_command (on) control (off)",
"manipulators": [
{
"conditions": [
{
"name": "ijkl_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "left_control",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"set_variable": {
"name": "ijkl_mode",
"value": 0
}
},
{
"key_code": "left_control",
"lazy": true
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "ijkl_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "left_command",
"modifiers": {
"optional": [
"any"
]
}
},
"parameters": {
"basic.to_if_held_down_threshold_milliseconds": 100
},
"to": [
{
"set_variable": {
"name": "ijkl_mode",
"value": 0
}
},
{
"key_code": "left_command",
"lazy": true
}
],
"to_if_alone": [
{
"set_variable": {
"name": "ijkl_mode",
"value": 1
}
}
],
"to_if_held_down": [
{
"set_variable": {
"name": "ijkl_mode",
"value": 0
}
},
{
"key_code": "left_command",
"lazy": true
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "ijkl_mode",
"type": "variable_if",
"value": 0
}
],
"from": {
"key_code": "left_command"
},
"parameters": {
"basic.to_if_held_down_threshold_milliseconds": 100
},
"to": [
{
"key_code": "left_command",
"lazy": true
}
],
"to_if_alone": [
{
"set_variable": {
"name": "ijkl_mode",
"value": 1
}
}
],
"to_if_held_down": [
{
"key_code": "left_command"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "ijkl_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "i",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "up_arrow"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "ijkl_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "j",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_arrow"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "ijkl_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "k",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "down_arrow"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "ijkl_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "l",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "right_arrow"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "ijkl_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "h",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "home"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "ijkl_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "semicolon",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "end"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "ijkl_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "p",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "page_up"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "ijkl_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "n",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "page_down"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "ijkl_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "u",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_arrow",
"modifiers": [
"left_option"
]
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "ijkl_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "o",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": [
"left_option"
]
}
],
"type": "basic"
}
]
}
]
}
{
"title": "Personal rules for Leo",
"rules": [
{
"description": "Application volume_decrement, right_shift+Appliaction volume_increment",
"manipulators": [
{
"from": {
"key_code": "application",
"modifiers": {
"mandatory": [
"right_shift"
]
}
},
"to": [
{
"key_code": "volume_increment"
}
],
"type": "basic"
},
{
"from": {
"key_code": "application"
},
"to": [
{
"key_code": "volume_decrement"
}
],
"type": "basic"
}
]
},
{
"description": "Left Option + h/; (semicolon) to home/end",
"manipulators": [
{
"from": {
"key_code": "h",
"modifiers": {
"mandatory": [
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "home"
}
],
"type": "basic"
},
{
"from": {
"key_code": "semicolon",
"modifiers": {
"mandatory": [
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "end"
}
],
"type": "basic"
}
]
},
{
"description": "Left Option + u/o to Left Option + left/right (prev/next word in Mac OS X)",
"manipulators": [
{
"from": {
"key_code": "u",
"modifiers": {
"mandatory": [
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_arrow",
"modifiers": [
"left_option"
]
}
],
"type": "basic"
},
{
"from": {
"key_code": "o",
"modifiers": {
"mandatory": [
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": [
"left_option"
]
}
],
"type": "basic"
}
]
},
{
"description": "Left Option + i/j/k/l to arrow up/left/down/right",
"manipulators": [
{
"from": {
"key_code": "i",
"modifiers": {
"mandatory": [
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "up_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "j",
"modifiers": {
"mandatory": [
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "k",
"modifiers": {
"mandatory": [
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "down_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "l",
"modifiers": {
"mandatory": [
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "right_arrow"
}
],
"type": "basic"
}
]
},
{
"description": "Right Command +k wasd, q/e to arrow and hom/end, r/f to page up/down",
"manipulators": [
{
"from": {
"key_code": "w",
"modifiers": {
"mandatory": [
"right_command"
]
}
},
"to": [
{
"key_code": "up_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "a",
"modifiers": {
"mandatory": [
"right_command"
]
}
},
"to": [
{
"key_code": "left_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "d",
"modifiers": {
"mandatory": [
"right_command"
]
}
},
"to": [
{
"key_code": "right_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "s",
"modifiers": {
"mandatory": [
"right_command"
]
}
},
"to": [
{
"key_code": "down_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "q",
"modifiers": {
"mandatory": [
"right_command"
]
}
},
"to": [
{
"key_code": "home"
}
],
"type": "basic"
},
{
"from": {
"key_code": "e",
"modifiers": {
"mandatory": [
"right_command"
]
}
},
"to": [
{
"key_code": "end"
}
],
"type": "basic"
},
{
"from": {
"key_code": "r",
"modifiers": {
"mandatory": [
"right_command"
]
}
},
"to": [
{
"key_code": "page_up"
}
],
"type": "basic"
},
{
"from": {
"key_code": "f",
"modifiers": {
"mandatory": [
"right_command"
]
}
},
"to": [
{
"key_code": "page_down"
}
],
"type": "basic"
}
]
},
{
"description": "Swap Left Command and Option",
"manipulators": [
{
"from": {
"key_code": "left_option",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_command"
}
],
"type": "basic"
},
{
"from": {
"key_code": "left_command",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_option"
}
],
"type": "basic"
}
]
},
{
"description": "Single Right command to Japanese eisuu/kana toggle",
"manipulators": [
{
"conditions": [
{
"input_sources": [
{
"language": "ja"
}
],
"type": "input_source_if"
}
],
"from": {
"key_code": "right_command",
"modifiers": {
"optional": [
"any"
]
}
},
"parameters": {
"basic.to_if_held_down_threshold_milliseconds": 100
},
"to": [
{
"key_code": "right_command",
"lazy": true
}
],
"to_if_alone": [
{
"key_code": "japanese_eisuu"
}
],
"to_if_held_down": [
{
"key_code": "right_command"
}
],
"type": "basic"
},
{
"conditions": [
{
"input_sources": [
{
"language": "en"
}
],
"type": "input_source_if"
}
],
"from": {
"key_code": "right_command",
"modifiers": {
"optional": [
"any"
]
}
},
"parameters": {
"basic.to_if_held_down_threshold_milliseconds": 100
},
"to": [
{
"key_code": "right_command",
"lazy": true
}
],
"to_if_alone": [
{
"key_code": "japanese_kana"
}
],
"to_if_held_down": [
{
"key_code": "right_command"
}
],
"type": "basic"
}
]
},
{
"description": "Left Ctrl+p/n to up/down",
"manipulators": [
{
"from": {
"key_code": "p",
"modifiers": {
"mandatory": [
"left_control"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "up_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "n",
"modifiers": {
"mandatory": [
"left_control"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "down_arrow"
}
],
"type": "basic"
}
]
},
{
"description": "Left Command+p/n to up/down",
"manipulators": [
{
"from": {
"key_code": "p",
"modifiers": {
"mandatory": [
"left_command"
]
}
},
"to": [
{
"key_code": "up_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "n",
"modifiers": {
"mandatory": [
"left_command"
]
}
},
"to": [
{
"key_code": "down_arrow"
}
],
"type": "basic"
}
]
},
{
"description": "Left Option+p/n to page_up/page_down",
"manipulators": [
{
"from": {
"key_code": "p",
"modifiers": {
"mandatory": [
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "page_up"
}
],
"type": "basic"
},
{
"from": {
"key_code": "n",
"modifiers": {
"mandatory": [
"left_option"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "page_down"
}
],
"type": "basic"
}
]
}
]
}

Add this json file in $HOME/.config/karabinar/assets/complex_modifications

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