Skip to content

Instantly share code, notes, and snippets.

@h2m730131
Last active September 8, 2024 16:27
Show Gist options
  • Save h2m730131/3deae79321d10a1617da5bd30cddecb0 to your computer and use it in GitHub Desktop.
Save h2m730131/3deae79321d10a1617da5bd30cddecb0 to your computer and use it in GitHub Desktop.
Remap the Keyboard in macOS: Karabiner-Elements
{
"profiles": [
{
"complex_modifications": {
"rules": [
{
"description": "⌃-J to switch between english and 倉頡",
"manipulators": [
{
"conditions": [
{
"input_sources": [
{
"input_mode_id": "com.apple.inputmethod.TCIM.Cangjie",
"input_source_id": "com.apple.inputmethod.TCIM.Cangjie",
"language": "zh-Hant"
}
],
"type": "input_source_if"
}
],
"from": {
"key_code": "j",
"modifiers": {
"mandatory": "left_control",
"optional": ["any"]
}
},
"to": [
{
"select_input_source": {
"input_source_id": "com.apple.keylayout.ABC",
"language": "en"
}
}
],
"type": "basic"
},
{
"conditions": [
{
"input_sources": [
{
"input_source_id": "com.apple.keylayout.ABC",
"language": "en"
}
],
"type": "input_source_if"
}
],
"from": {
"key_code": "j",
"modifiers": {
"mandatory": "left_control",
"optional": ["any"]
}
},
"to": [
{
"select_input_source": {
"input_mode_id": "com.apple.inputmethod.TCIM.Cangjie",
"input_source_id": "com.apple.inputmethod.TCIM.Cangjie",
"language": "zh-Hant"
}
}
],
"type": "basic"
}
]
},
{
"description": "Change left_option+hjkl to arrow keys",
"manipulators": [
{
"from": {
"key_code": "h",
"modifiers": {
"mandatory": ["left_option"],
"optional": ["any"]
}
},
"to": [{ "key_code": "left_arrow" }],
"type": "basic"
},
{
"from": {
"key_code": "j",
"modifiers": {
"mandatory": ["left_option"],
"optional": ["any"]
}
},
"to": [{ "key_code": "down_arrow" }],
"type": "basic"
},
{
"from": {
"key_code": "k",
"modifiers": {
"mandatory": ["left_option"],
"optional": ["any"]
}
},
"to": [{ "key_code": "up_arrow" }],
"type": "basic"
},
{
"from": {
"key_code": "l",
"modifiers": {
"mandatory": ["left_option"],
"optional": ["any"]
}
},
"to": [{ "key_code": "right_arrow" }],
"type": "basic"
}
]
}
]
},
"devices": [
{
"identifiers": {
"is_keyboard": true,
"product_id": 34050,
"vendor_id": 2652
},
"simple_modifications": [
{
"from": { "key_code": "caps_lock" },
"to": [{ "key_code": "escape" }]
}
]
}
],
"name": "Default profile",
"selected": true
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment