Skip to content

Instantly share code, notes, and snippets.

@kazuph
Last active August 15, 2025 03:06
Show Gist options
  • Select an option

  • Save kazuph/19fe1e4814c85533c199c35ac5aa9239 to your computer and use it in GitHub Desktop.

Select an option

Save kazuph/19fe1e4814c85533c199c35ac5aa9239 to your computer and use it in GitHub Desktop.
Karabiner-Elements configuration with F13/F24 profile switching (JIS ⇄ moNa2) + original key functions preserved
{
"global": { "show_profile_name_in_menu_bar": true },
"profiles": [
{
"complex_modifications": {
"rules": [
{
"description": "F24 -> Fn (globe) + switch to moNa2",
"manipulators": [
{
"from": { "key_code": "f24" },
"to": [{ "shell_command": "/Library/Application\\ Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli --select-profile 'moNa2'" }],
"to_if_held_down": [{ "apple_vendor_top_case_key_code": "keyboard_fn" }],
"type": "basic"
}
]
},
{
"description": "F18 to - ",
"manipulators": [
{
"from": { "key_code": "f18" },
"to": [
{ "key_code": "japanese_eisuu" },
{ "key_code": "hyphen" },
{ "key_code": "spacebar" }
],
"type": "basic"
}
]
},
{
"description": "F17 to ## ",
"manipulators": [
{
"from": { "key_code": "f17" },
"to": [
{ "key_code": "japanese_eisuu" },
{
"key_code": "3",
"modifiers": ["shift"]
},
{
"key_code": "3",
"modifiers": ["shift"]
},
{ "key_code": "spacebar" }
],
"type": "basic"
}
]
},
{
"description": "F16 to ```",
"manipulators": [
{
"from": { "key_code": "f16" },
"to": [
{ "key_code": "japanese_eisuu" },
{
"key_code": "grave_accent_and_tilde",
"modifiers": []
},
{
"key_code": "grave_accent_and_tilde",
"modifiers": []
},
{
"key_code": "grave_accent_and_tilde",
"modifiers": []
}
],
"type": "basic"
}
]
},
{
"description": "F15 to ``←",
"manipulators": [
{
"from": { "key_code": "f15" },
"to": [
{ "key_code": "japanese_eisuu" },
{
"key_code": "grave_accent_and_tilde",
"modifiers": []
},
{
"key_code": "grave_accent_and_tilde",
"modifiers": []
},
{ "key_code": "left_arrow" }
],
"type": "basic"
}
]
},
{
"description": "F14 to :",
"manipulators": [
{
"from": { "key_code": "f14" },
"to": [
{ "key_code": "japanese_eisuu" },
{ "key_code": "quote" }
],
"type": "basic"
}
]
},
{
"description": "F13 to ⌘+Space and 英数 + switch to moNa2",
"manipulators": [
{
"from": { "key_code": "f13" },
"to": [
{
"key_code": "spacebar",
"modifiers": ["command"]
},
{ "key_code": "japanese_eisuu" },
{ "shell_command": "/Library/Application\\ Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli --select-profile 'moNa2'" }
],
"type": "basic"
}
]
},
{
"description": "Ctrl 単押しで Esc",
"manipulators": [
{
"from": {
"key_code": "left_control",
"modifiers": { "optional": ["any"] }
},
"to": [{ "key_code": "left_control" }],
"to_if_alone": [
{ "key_code": "escape" },
{ "key_code": "japanese_eisuu" }
],
"type": "basic"
}
]
},
{
"description": "Ctrl+Cを押してEsc",
"manipulators": [
{
"from": {
"key_code": "c",
"modifiers": { "mandatory": ["control"] }
},
"to": [
{
"key_code": "c",
"modifiers": ["right_ctrl"]
},
{ "key_code": "escape" },
{ "key_code": "japanese_eisuu" }
],
"type": "basic"
}
]
},
{
"description": "コマンドキーを単体で押したときに、英数・かなキーを送信する。(左コマンドキーは英数、右コマンドキーはかな) (rev 3)",
"manipulators": [
{
"from": {
"key_code": "left_command",
"modifiers": { "optional": ["any"] }
},
"parameters": { "basic.to_if_held_down_threshold_milliseconds": 100 },
"to": [
{
"key_code": "left_command",
"lazy": true
}
],
"to_if_alone": [{ "key_code": "japanese_eisuu" }],
"to_if_held_down": [{ "key_code": "left_command" }],
"type": "basic"
},
{
"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": "Ctrl+[を押したときに、escキーと英数キーを送信する",
"manipulators": [
{
"conditions": [
{
"keyboard_types": ["ansi", "iso"],
"type": "keyboard_type_if"
}
],
"from": {
"key_code": "open_bracket",
"modifiers": { "mandatory": ["control"] }
},
"to": [
{ "key_code": "escape" },
{ "key_code": "japanese_eisuu" }
],
"type": "basic"
},
{
"conditions": [
{
"keyboard_types": ["jis"],
"type": "keyboard_type_if"
}
],
"from": {
"key_code": "close_bracket",
"modifiers": { "mandatory": ["control"] }
},
"to": [
{ "key_code": "escape" },
{ "key_code": "japanese_eisuu" }
],
"type": "basic"
}
]
},
{
"description": "Ctrl+Cを押したときに、英数キーも送信する(vim用) (by kazuph)",
"manipulators": [
{
"conditions": [
{
"keyboard_types": ["ansi", "iso"],
"type": "keyboard_type_if"
}
],
"from": {
"key_code": "c",
"modifiers": { "mandatory": ["control"] }
},
"to": [
{
"key_code": "c",
"modifiers": ["control"]
},
{ "key_code": "japanese_eisuu" }
],
"type": "basic"
},
{
"conditions": [
{
"keyboard_types": ["jis"],
"type": "keyboard_type_if"
}
],
"from": {
"key_code": "c",
"modifiers": { "mandatory": ["control"] }
},
"to": [
{
"key_code": "c",
"modifiers": ["control"]
},
{ "key_code": "japanese_eisuu" }
],
"type": "basic"
}
]
},
{
"description": "Right Shift key to switch to JIS profile (conditional)",
"manipulators": [
{
"from": { "key_code": "right_shift" },
"to": [{ "shell_command": "CURRENT=$(/Library/Application\\ Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli --show-current-profile-name); if [ \"$CURRENT\" != \"JIS\" ]; then /Library/Application\\ Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli --select-profile 'JIS'; fi" }],
"type": "basic"
}
]
}
]
},
"devices": [
{
"identifiers": {
"is_keyboard": true,
"is_pointing_device": true,
"product_id": 24926,
"vendor_id": 7504
},
"ignore": false,
"ignore_vendor_events": true
}
],
"fn_function_keys": [
{
"from": { "key_code": "f3" },
"to": [{ "key_code": "mission_control" }]
},
{
"from": { "key_code": "f4" },
"to": [{ "key_code": "launchpad" }]
},
{
"from": { "key_code": "f5" },
"to": [{ "key_code": "illumination_decrement" }]
},
{
"from": { "key_code": "f6" },
"to": [{ "key_code": "illumination_increment" }]
},
{
"from": { "key_code": "f7" },
"to": [{ "key_code": "f7" }]
}
],
"name": "JIS",
"virtual_hid_keyboard": {
"country_code": 45,
"keyboard_type_v2": "jis"
}
},
{
"complex_modifications": {
"rules": [
{
"description": "F24 -> Fn (globe) + switch to moNa2",
"manipulators": [
{
"from": { "key_code": "f24" },
"to": [{ "shell_command": "/Library/Application\\ Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli --select-profile 'moNa2'" }],
"to_if_held_down": [{ "apple_vendor_top_case_key_code": "keyboard_fn" }],
"type": "basic"
}
]
},
{
"description": "F18 to - ",
"manipulators": [
{
"from": { "key_code": "f18" },
"to": [
{ "key_code": "japanese_eisuu" },
{ "key_code": "hyphen" },
{ "key_code": "spacebar" }
],
"type": "basic"
}
]
},
{
"description": "F17 to ## ",
"manipulators": [
{
"from": { "key_code": "f17" },
"to": [
{ "key_code": "japanese_eisuu" },
{
"key_code": "3",
"modifiers": ["shift"]
},
{
"key_code": "3",
"modifiers": ["shift"]
},
{ "key_code": "spacebar" }
],
"type": "basic"
}
]
},
{
"description": "F16 to ```",
"manipulators": [
{
"from": { "key_code": "f16" },
"to": [
{ "key_code": "japanese_eisuu" },
{
"key_code": "grave_accent_and_tilde",
"modifiers": []
},
{
"key_code": "grave_accent_and_tilde",
"modifiers": []
},
{
"key_code": "grave_accent_and_tilde",
"modifiers": []
}
],
"type": "basic"
}
]
},
{
"description": "F15 to ``←",
"manipulators": [
{
"from": { "key_code": "f15" },
"to": [
{ "key_code": "japanese_eisuu" },
{
"key_code": "grave_accent_and_tilde",
"modifiers": []
},
{
"key_code": "grave_accent_and_tilde",
"modifiers": []
},
{ "key_code": "left_arrow" }
],
"type": "basic"
}
]
},
{
"description": "F14 to :",
"manipulators": [
{
"from": { "key_code": "f14" },
"to": [
{ "key_code": "japanese_eisuu" },
{ "key_code": "quote" }
],
"type": "basic"
}
]
},
{
"description": "F13 to ⌘+Space and 英数 + switch to moNa2",
"manipulators": [
{
"from": { "key_code": "f13" },
"to": [
{
"key_code": "spacebar",
"modifiers": ["command"]
},
{ "key_code": "japanese_eisuu" },
{ "shell_command": "/Library/Application\\ Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli --select-profile 'moNa2'" }
],
"type": "basic"
}
]
},
{
"description": "Ctrl 単押しで Esc",
"manipulators": [
{
"from": {
"key_code": "left_control",
"modifiers": { "optional": ["any"] }
},
"to": [{ "key_code": "left_control" }],
"to_if_alone": [
{ "key_code": "escape" },
{ "key_code": "japanese_eisuu" }
],
"type": "basic"
}
]
},
{
"description": "Ctrl+Cを押してEsc",
"manipulators": [
{
"from": {
"key_code": "c",
"modifiers": { "mandatory": ["control"] }
},
"to": [
{
"key_code": "c",
"modifiers": ["right_ctrl"]
},
{ "key_code": "escape" },
{ "key_code": "japanese_eisuu" }
],
"type": "basic"
}
]
},
{
"description": "コマンドキーを単体で押したときに、英数・かなキーを送信する。(左コマンドキーは英数、右コマンドキーはかな) (rev 3)",
"manipulators": [
{
"from": {
"key_code": "left_command",
"modifiers": { "optional": ["any"] }
},
"parameters": { "basic.to_if_held_down_threshold_milliseconds": 100 },
"to": [
{
"key_code": "left_command",
"lazy": true
}
],
"to_if_alone": [{ "key_code": "japanese_eisuu" }],
"to_if_held_down": [{ "key_code": "left_command" }],
"type": "basic"
},
{
"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": "Ctrl+[を押したときに、escキーと英数キーを送信する",
"manipulators": [
{
"conditions": [
{
"keyboard_types": ["ansi", "iso"],
"type": "keyboard_type_if"
}
],
"from": {
"key_code": "open_bracket",
"modifiers": { "mandatory": ["control"] }
},
"to": [
{ "key_code": "escape" },
{ "key_code": "japanese_eisuu" }
],
"type": "basic"
},
{
"conditions": [
{
"keyboard_types": ["jis"],
"type": "keyboard_type_if"
}
],
"from": {
"key_code": "close_bracket",
"modifiers": { "mandatory": ["control"] }
},
"to": [
{ "key_code": "escape" },
{ "key_code": "japanese_eisuu" }
],
"type": "basic"
}
]
},
{
"description": "Ctrl+Cを押したときに、英数キーも送信する(vim用) (by kazuph)",
"manipulators": [
{
"conditions": [
{
"keyboard_types": ["ansi", "iso"],
"type": "keyboard_type_if"
}
],
"from": {
"key_code": "c",
"modifiers": { "mandatory": ["control"] }
},
"to": [
{
"key_code": "c",
"modifiers": ["control"]
},
{ "key_code": "japanese_eisuu" }
],
"type": "basic"
},
{
"conditions": [
{
"keyboard_types": ["jis"],
"type": "keyboard_type_if"
}
],
"from": {
"key_code": "c",
"modifiers": { "mandatory": ["control"] }
},
"to": [
{
"key_code": "c",
"modifiers": ["control"]
},
{ "key_code": "japanese_eisuu" }
],
"type": "basic"
}
]
},
{
"description": "Right Shift key to switch to JIS profile (conditional)",
"manipulators": [
{
"from": { "key_code": "right_shift" },
"to": [{ "shell_command": "CURRENT=$(/Library/Application\\ Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli --show-current-profile-name); if [ \"$CURRENT\" != \"JIS\" ]; then /Library/Application\\ Support/org.pqrs/Karabiner-Elements/bin/karabiner_cli --select-profile 'JIS'; fi" }],
"type": "basic"
}
]
}
]
},
"devices": [
{
"identifiers": {
"is_keyboard": true,
"is_pointing_device": true,
"product_id": 24926,
"vendor_id": 7504
},
"ignore": false,
"ignore_vendor_events": true
}
],
"fn_function_keys": [
{
"from": { "key_code": "f3" },
"to": [{ "key_code": "mission_control" }]
},
{
"from": { "key_code": "f4" },
"to": [{ "key_code": "launchpad" }]
},
{
"from": { "key_code": "f5" },
"to": [{ "key_code": "illumination_decrement" }]
},
{
"from": { "key_code": "f6" },
"to": [{ "key_code": "illumination_increment" }]
},
{
"from": { "key_code": "f7" },
"to": [{ "key_code": "f7" }]
}
],
"name": "moNa2",
"selected": true,
"virtual_hid_keyboard": {
"country_code": 45,
"keyboard_type_v2": "ansi"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment