Skip to content

Instantly share code, notes, and snippets.

@DennyWeinberg
Last active October 2, 2023 06:25
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 DennyWeinberg/2a6fa2dc12739134fe511aded8320e2a to your computer and use it in GitHub Desktop.
Save DennyWeinberg/2a6fa2dc12739134fe511aded8320e2a to your computer and use it in GitHub Desktop.
Karabiner Elements JSON configuration for an external keyboard (And RDP specific things)
{
"title": "DWE",
"rules": [
{
"description": "Keyboards",
"manipulators": [
{
"description": "Space is switch to external keyboard input source", "type": "basic",
"from": {"key_code": "spacebar"}, "to": [{"select_input_source": {"input_source_id": "com.apple.keylayout.German-DIN-2137"}}, {"key_code": "spacebar"}],
"conditions": [
{"type": "device_if", "identifiers": [{"vendor_id": 9610, "product_id": 1, "description": "USB Keyboard"}]},
{"type": "input_source_unless", "input_sources": [{"input_source_id": "com.apple.keylayout.German-DIN-2137"}]}
]
},
{
"description": "Space is switch to internal keyboard input source", "type": "basic",
"from": {"key_code": "spacebar"}, "to": [{"select_input_source": {"input_source_id": "com.apple.keylayout.SwissGerman"}}, {"key_code": "spacebar"}],
"conditions": [
{"type": "device_unless", "identifiers": [{"vendor_id": 9610, "product_id": 1, "description": "Internal Keyboard"}]},
{"type": "input_source_unless", "input_sources": [{"input_source_id": "com.apple.keylayout.SwissGerman"}]}
]
},
{
"description": "Home is jump left (Not for RDP)", "type": "basic",
"from": {"key_code": "home"}, "to": [{"key_code": "left_arrow", "modifiers": ["command"]}],
"conditions": [
{"type": "frontmost_application_unless", "bundle_identifiers": ["com\\.microsoft\\.rdc\\.osx\\.beta", "com\\.microsoft\\.rdc\\.macos", "com\\.microsoft\\.teams"]},
{"type": "device_if", "identifiers": [{"vendor_id": 9610, "product_id": 1, "description": "USB Keyboard"}]}
]
},
{
"description": "End is jump left (Not for RDP)", "type": "basic",
"from": {"key_code": "end"}, "to": [{"key_code": "right_arrow", "modifiers": ["command"]}],
"conditions": [
{"type": "frontmost_application_unless", "bundle_identifiers": ["com\\.microsoft\\.rdc\\.osx\\.beta", "com\\.microsoft\\.rdc\\.macos", "com\\.microsoft\\.teams"]},
{"type": "device_if", "identifiers": [{"vendor_id": 9610, "product_id": 1, "description": "USB Keyboard"}]}
]
},
{
"description": "CTRL is command (Not for RDP)", "type": "basic",
"from": {"key_code": "left_control"}, "to": [{"key_code": "left_command"}],
"conditions": [
{"type": "frontmost_application_unless", "bundle_identifiers": ["com\\.microsoft\\.rdc\\.osx\\.beta", "com\\.microsoft\\.rdc\\.macos", "com\\.microsoft\\.teams"]},
{"type": "device_if", "identifiers": [{"vendor_id": 9610, "product_id": 1, "description": "USB Keyboard"}]}
]
},
{
"description": "ALT+c is control+c (Not for RDP)", "type": "basic",
"from": {"key_code": "c", "modifiers": {"mandatory": ["left_option"]}}, "to": [{"key_code": "c", "modifiers": ["left_control"]}],
"conditions": [
{"type": "frontmost_application_unless", "bundle_identifiers": ["com\\.microsoft\\.rdc\\.osx\\.beta", "com\\.microsoft\\.rdc\\.macos", "com\\.microsoft\\.teams"]},
{"type": "device_if", "identifiers": [{"vendor_id": 9610, "product_id": 1, "description": "USB Keyboard"}]}
]
},
{
"description": "ALT+r is control+c (Not for RDP)", "type": "basic",
"from": {"key_code": "r", "modifiers": {"mandatory": ["left_option"]}}, "to": [{"key_code": "r", "modifiers": ["left_control"]}],
"conditions": [
{"type": "frontmost_application_unless", "bundle_identifiers": ["com\\.microsoft\\.rdc\\.osx\\.beta", "com\\.microsoft\\.rdc\\.macos", "com\\.microsoft\\.teams"]},
{"type": "device_if", "identifiers": [{"vendor_id": 9610, "product_id": 1, "description": "USB Keyboard"}]}
]
},
{
"description": "CTRL+Left Arrow is command (Not for RDP)", "type": "basic",
"from": {"key_code": "left_arrow", "modifiers": {"mandatory": ["left_command"], "optional": ["shift"]}}, "to": [{"key_code": "left_arrow", "modifiers": ["left_option"]}],
"conditions": [
{"type": "frontmost_application_unless", "bundle_identifiers": ["com\\.microsoft\\.rdc\\.osx\\.beta", "com\\.microsoft\\.rdc\\.macos", "com\\.microsoft\\.teams"]},
{"type": "device_if", "identifiers": [{"vendor_id": 9610, "product_id": 1, "description": "USB Keyboard"}]}
]
},
{
"description": "CTRL+Right Arrow is command (Not for RDP)", "type": "basic",
"from": {"key_code": "right_arrow", "modifiers": {"mandatory": ["left_command"], "optional": ["shift"]}}, "to": [{"key_code": "right_arrow", "modifiers": ["left_option"]}],
"conditions": [
{"type": "frontmost_application_unless", "bundle_identifiers": ["com\\.microsoft\\.rdc\\.osx\\.beta", "com\\.microsoft\\.rdc\\.macos", "com\\.microsoft\\.teams"]},
{"type": "device_if", "identifiers": [{"vendor_id": 9610, "product_id": 1, "description": "USB Keyboard"}]}
]
},
{
"description": "CTRL+Tab is CTRL+Tab (Not for RDP)", "type": "basic",
"from": {"key_code": "tab", "modifiers": {"mandatory": ["left_command"], "optional": ["shift"]}}, "to": [{"key_code": "tab", "modifiers": ["left_control"]}],
"conditions": [
{"type": "frontmost_application_unless", "bundle_identifiers": ["com\\.microsoft\\.rdc\\.osx\\.beta", "com\\.microsoft\\.rdc\\.macos", "com\\.microsoft\\.teams"]},
{"type": "device_if", "identifiers": [{"vendor_id": 9610, "product_id": 1, "description": "USB Keyboard"}]}
]
},
{
"description": "Alt+Tab is option+Tab (Not for RDP)", "type": "basic",
"from": {"key_code": "tab", "modifiers": {"mandatory": ["left_option"]}}, "to": [{"key_code": "tab", "modifiers": ["command"]}],
"conditions": [
{"type": "frontmost_application_unless", "bundle_identifiers": ["com\\.microsoft\\.rdc\\.osx\\.beta", "com\\.microsoft\\.rdc\\.macos", "com\\.microsoft\\.teams"]},
{"type": "device_if", "identifiers": [{"vendor_id": 9610, "product_id": 1, "description": "USB Keyboard"}]}
]
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment