Skip to content

Instantly share code, notes, and snippets.

@martinloretzzz
Last active August 27, 2025 07:58
Show Gist options
  • Select an option

  • Save martinloretzzz/821cba912977abbc9a6dc2322d01ffc4 to your computer and use it in GitHub Desktop.

Select an option

Save martinloretzzz/821cba912977abbc9a6dc2322d01ffc4 to your computer and use it in GitHub Desktop.
Ubuntu keymapping on a mac (German Layout) wit karabiner
{
"title": "Ubuntu style keymapping (german keyboard)",
"rules": [
{
"description": "Disable rules when right option is pressed",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "right_option",
"modifiers": {
"optional": ["any"]
}
},
"to": [
{
"set_variable": {
"name": "rules_enabled",
"value": 0
}
}
],
"to_after_key_up": [
{
"set_variable": {
"name": "rules_enabled",
"value": 1
}
}
]
}
]
},
{
"description": "PC-Style German Alt Gr (Backslash, @, pipe, tilde, brackets)",
"manipulators": [
{
"from": {
"key_code": "hyphen",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "7",
"modifiers": ["shift", "left_option"]
}
],
"type": "basic",
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"from": {
"key_code": "q",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "l",
"modifiers": ["left_option"]
}
],
"type": "basic",
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"from": {
"key_code": "grave_accent_and_tilde",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "7",
"modifiers": ["left_option"]
}
],
"type": "basic",
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"from": {
"key_code": "close_bracket",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "n",
"modifiers": ["left_option"]
}
],
"type": "basic",
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"from": {
"key_code": "7",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "8",
"modifiers": ["right_option"]
}
],
"type": "basic",
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"from": {
"key_code": "0",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "9",
"modifiers": ["right_option"]
}
],
"type": "basic",
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"from": {
"key_code": "8",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "5",
"modifiers": ["right_option"]
}
],
"type": "basic",
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"from": {
"key_code": "9",
"modifiers": {
"mandatory": ["right_command"],
"optional": ["any"]
}
},
"to": [
{
"key_code": "6",
"modifiers": ["right_option"]
}
],
"type": "basic",
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
}
]
},
{
"description": "Map PrintScreen key to Screenshot Selection and Screen Lock",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "3", "modifiers": { "mandatory": ["left_command", "left_shift"] } },
"to": [ { "key_code": "4", "modifiers": ["left_command", "left_shift"] } ],
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "l", "modifiers": { "mandatory": ["control", "option"] } },
"to": [ { "key_code": "q", "modifiers": ["left_control", "left_command"] } ],
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
}
]
},
{
"description": "Map go to reference for vscode",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "left_control" },
"to": [{ "key_code": "left_control" }],
"to_if_held_down": [{ "key_code": "left_command" }],
"conditions": [
{ "type": "variable_if", "name": "rules_enabled", "value": 1 },
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^com\\.microsoft\\.VSCode$"
]
}
]
}
]
},
{
"description": "Linux-style cursor movement with Ctrl",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "left_arrow", "modifiers": { "mandatory": ["control"] } },
"to": [ { "key_code": "left_arrow", "modifiers": ["option"] } ],
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "right_arrow", "modifiers": { "mandatory": ["control"] } },
"to": [ { "key_code": "right_arrow", "modifiers": ["option"] } ],
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "up_arrow", "modifiers": { "mandatory": ["control"] } },
"to": [ { "key_code": "page_up" } ],
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "down_arrow", "modifiers": { "mandatory": ["control"] } },
"to": [ { "key_code": "page_down" } ],
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "delete_or_backspace", "modifiers": { "mandatory": ["control"] } },
"to": [ { "key_code": "delete_or_backspace", "modifiers": ["option"] } ],
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "delete_forward", "modifiers": { "mandatory": ["control"] } },
"to": [ { "key_code": "delete_forward", "modifiers": ["option"] } ],
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
}
]
},
{
"description": "Linux-style editing: Ctrl+C/V/X/Z/S/A/F/Z/S",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "c", "modifiers": { "mandatory": ["left_control"] } },
"to": [ { "key_code": "c", "modifiers": ["command"] } ],
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "v", "modifiers": { "mandatory": ["left_control"] } },
"to": [ { "key_code": "v", "modifiers": ["command"] } ],
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "x", "modifiers": { "mandatory": ["left_control"] } },
"to": [ { "key_code": "x", "modifiers": ["command"] } ],
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "z", "modifiers": { "mandatory": ["left_control"] } },
"to": [ { "key_code": "z", "modifiers": ["command"] } ],
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "s", "modifiers": { "mandatory": ["left_control"] } },
"to": [ { "key_code": "s", "modifiers": ["command"] } ],
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "a", "modifiers": { "mandatory": ["left_control"] } },
"to": [ { "key_code": "a", "modifiers": ["command"] } ],
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "f", "modifiers": { "mandatory": ["left_control"] } },
"to": [ { "key_code": "f", "modifiers": ["command"] } ],
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "s", "modifiers": { "mandatory": ["left_control"] } },
"to": [ { "key_code": "s", "modifiers": ["command"] } ],
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "y", "modifiers": { "mandatory": ["left_control", "shift"] } },
"to": [ { "key_code": "y", "modifiers": ["command", "shift"] } ],
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
},
{
"type": "basic",
"from": { "key_code": "y", "modifiers": { "mandatory": ["left_control"] } },
"to": [ { "key_code": "y", "modifiers": ["command"] } ],
"conditions": [ { "type": "variable_if", "name": "rules_enabled", "value": 1 } ]
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment