Skip to content

Instantly share code, notes, and snippets.

@iFwu
Created July 29, 2025 17:04
Show Gist options
  • Save iFwu/521d6eb75b77d766bcadb30003246a32 to your computer and use it in GitHub Desktop.
Save iFwu/521d6eb75b77d766bcadb30003246a32 to your computer and use it in GitHub Desktop.
Karabiner-Elements Configuration Examples
{
"profiles": [
{
"name": "custom",
"selected": true,
"virtual_hid_keyboard": {
"caps_lock_delay_milliseconds": 300,
"keyboard_type": "ansi"
},
"complex_modifications": {
"parameters": {
"basic.to_delayed_action_delay_milliseconds": 300,
"basic.to_if_alone_timeout_milliseconds": 200
},
"rules": [
{
"description": "Tap Caps Lock for ESC or Hold for Control",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "caps_lock",
"modifiers": { "optional": ["any"] }
},
"to": [
{
"key_code": "left_control",
"lazy": true
}
],
"to_if_alone": [{ "key_code": "escape" }]
}
]
},
{
"description": "Change 'Option+D' to forward delete word",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "d",
"modifiers": { "mandatory": ["left_option"] }
},
"to": [
{
"key_code": "delete_forward",
"modifiers": ["left_option"]
}
]
}
]
},
{
"description": "Single tap Left Command to open App Launcher (可自定义快捷键)",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "left_command" },
"to": [
{
"key_code": "left_command",
"lazy": true
}
],
"to_if_alone": [
{
"key_code": "space",
"modifiers": ["left_command"]
}
],
"description": "示例:可改为自己的应用启动快捷键"
}
]
},
{
"description": "Single tap Left Option to open Clipboard Manager (可自定义)",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "left_option" },
"to": [
{
"key_code": "left_option",
"lazy": true
}
],
"to_if_alone": [
{
"key_code": "v",
"modifiers": ["left_shift", "left_command"]
}
]
}
]
},
{
"description": "Single tap Right Command to open Task Manager (可自定义)",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "right_command" },
"to": [
{
"key_code": "right_command",
"lazy": true
}
],
"to_if_alone": [
{
"key_code": "t",
"modifiers": ["left_shift", "left_command"]
}
]
}
]
},
{
"description": "Single tap Right Option to open Terminal",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "right_option" },
"to": [
{
"key_code": "right_option",
"lazy": true
}
],
"to_if_alone": [
{
"shell_command": "open -a Terminal"
}
]
}
]
},
{
"description": "App-specific remapping example (Android Emulator)",
"manipulators": [
{
"type": "basic",
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": ["^com\\.example\\.app$"]
}
],
"from": {
"key_code": "z",
"modifiers": { "mandatory": ["left_command", "left_control"] }
},
"to": [
{
"key_code": "m",
"modifiers": ["left_command"]
}
],
"description": "示例:可根据需要修改应用的 bundle ID"
}
]
},
{
"description": "Double tap Right Shift to open Screenshot Tool",
"manipulators": [
{
"type": "basic",
"conditions": [
{
"type": "variable_if",
"name": "right_shift pressed",
"value": 1
}
],
"from": {
"key_code": "right_shift",
"modifiers": { "optional": ["any"] }
},
"to": [
{
"key_code": "4",
"modifiers": ["left_shift", "left_command"]
}
]
},
{
"type": "basic",
"from": {
"key_code": "right_shift",
"modifiers": { "optional": ["any"] }
},
"to": [
{
"set_variable": {
"name": "right_shift pressed",
"value": 1
}
},
{ "key_code": "right_shift" }
],
"to_delayed_action": {
"to_if_canceled": [
{
"set_variable": {
"name": "right_shift pressed",
"value": 0
}
}
],
"to_if_invoked": [
{
"set_variable": {
"name": "right_shift pressed",
"value": 0
}
}
]
}
}
]
},
{
"description": "Delete Forward key to open Quick Chat (可自定义)",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "delete_forward" },
"to": [
{
"shell_command": "open -a 'YourChatApp'"
}
],
"description": "示例:替换为自己的聊天应用"
}
]
},
{
"description": "Fn + ` to lock screen",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "grave_accent_and_tilde",
"modifiers": { "mandatory": ["fn"] }
},
"to": [
{
"key_code": "q",
"modifiers": ["left_control", "left_command"]
}
]
}
]
}
]
},
"devices": []
}
]
}
EOF < /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment