From a6a09fc69300d7122447a352390b8d7495b1bc47 Mon Sep 17 00:00:00 2001 From: Roberto Leinardi Date: Thu, 23 Jul 2026 16:07:36 +0200 Subject: [PATCH] Update karabiner json --- .../files/karabiner/karabiner.json | 821 ++++++++++-------- 1 file changed, 441 insertions(+), 380 deletions(-) diff --git a/roles/karabiner_elements/files/karabiner/karabiner.json b/roles/karabiner_elements/files/karabiner/karabiner.json index ec58ffc..fc1c32d 100644 --- a/roles/karabiner_elements/files/karabiner/karabiner.json +++ b/roles/karabiner_elements/files/karabiner/karabiner.json @@ -4,25 +4,42 @@ "complex_modifications": { "rules": [ { - "description": "Linux: F5 to reload in browsers", + "description": "Linux (IT layout): Keypad period => '.'", "manipulators": [ { "conditions": [ { - "bundle_identifiers": [ - "^com\\.microsoft\\.edgemac$", - "^com\\.google\\.Chrome$", - "^com\\.brave\\.Browser$", - "^com\\.apple\\.Safari$" - ], - "type": "frontmost_application_if" + "input_sources": [{ "language": "^it$" }], + "type": "input_source_if" } ], - "from": { "key_code": "f5" }, + "from": { + "key_code": "keypad_period", + "modifiers": { "optional": ["any"] } + }, + "to": [{ "key_code": "period" }], + "type": "basic" + } + ] + }, + { + "description": "Linux (IT layout): AltGr + i-grave produces tilde (~)", + "manipulators": [ + { + "conditions": [ + { + "input_sources": [{ "language": "^it$" }], + "type": "input_source_if" + } + ], + "from": { + "key_code": "equal_sign", + "modifiers": { "mandatory": ["right_option"] } + }, "to": [ { - "key_code": "r", - "modifiers": ["left_command"] + "key_code": "5", + "modifiers": ["option"] } ], "type": "basic" @@ -30,36 +47,53 @@ ] }, { - "description": "Linux: F2 renames files and Enter opens files in Finder", + "description": "Linux (IT layout): AltGr + apostrophe produces backtick (`)", "manipulators": [ { "conditions": [ { - "bundle_identifiers": [ - "^com\\.apple\\.finder$" - ], - "type": "frontmost_application_if" + "input_sources": [{ "language": "^it$" }], + "type": "input_source_if" } ], "from": { - "key_code": "f2", - "modifiers": { "optional": ["any"] } + "key_code": "hyphen", + "modifiers": { "mandatory": ["right_option"] } }, "to": [ { - "set_variable": { - "name": "rename_from_f2", - "value": 1 - } - }, - { "key_code": "return_or_enter" } + "key_code": "grave_accent_and_tilde", + "modifiers": ["option"] + } ], - "to_after_key_up": [ + "type": "basic" + } + ] + }, + { + "description": "Linux: Ctrl + Backspace deletes word by word (Option + Delete), Ctrl variant used natively in Ghostty", + "manipulators": [ + { + "conditions": [ { - "set_variable": { - "name": "rename_from_f2", - "value": 0 - } + "bundle_identifiers": [ + "^com\\.utmapp\\.UTM$", + "^com\\.mitchellh\\.ghostty$" + ], + "type": "frontmost_application_unless" + } + ], + "from": { + "key_code": "delete_or_backspace", + "modifiers": { + "mandatory": ["command"], + "optional": ["caps_lock"] + } + }, + "to": [ + { + "key_code": "delete_or_backspace", + "modifiers": ["option"] } ], "type": "basic" @@ -68,24 +102,22 @@ "conditions": [ { "bundle_identifiers": [ - "^com\\.apple\\.finder$" + "^com\\.mitchellh\\.ghostty$" ], "type": "frontmost_application_if" - }, - { - "name": "rename_from_f2", - "type": "variable_unless", - "value": 1 } ], "from": { - "key_code": "return_or_enter", - "modifiers": { "optional": ["any"] } + "key_code": "delete_or_backspace", + "modifiers": { + "mandatory": ["control"], + "optional": ["caps_lock"] + } }, "to": [ { - "key_code": "down_arrow", - "modifiers": ["command"] + "key_code": "delete_or_backspace", + "modifiers": ["option"] } ], "type": "basic" @@ -93,20 +125,29 @@ ] }, { - "description": "Linux: Option + F4 maps to Command + Q (Quit Application)", + "description": "Linux: Ctrl + Del (forward delete) deletes word by word (Option + Forward Delete)", "manipulators": [ { + "conditions": [ + { + "bundle_identifiers": [ + "^com\\.utmapp\\.UTM$", + "^com\\.mitchellh\\.ghostty$" + ], + "type": "frontmost_application_unless" + } + ], "from": { - "key_code": "f4", + "key_code": "delete_forward", "modifiers": { - "mandatory": ["option"], + "mandatory": ["command"], "optional": ["caps_lock"] } }, "to": [ { - "key_code": "q", - "modifiers": ["command"] + "key_code": "delete_forward", + "modifiers": ["option"] } ], "type": "basic" @@ -114,29 +155,29 @@ ] }, { - "description": "Browsers: Convert Option + Left/Right Arrow to Command + Left/Right Arrow", + "description": "Linux: Ctrl + Left/Right moves word by word (Option + Left/Right); excluded apps handle this natively", "manipulators": [ { "conditions": [ { "bundle_identifiers": [ - "^org\\.mozilla\\.firefox$", - "^com\\.google\\.Chrome$" + "^com\\.utmapp\\.UTM$", + "^com\\.mitchellh\\.ghostty$" ], - "type": "frontmost_application_if" + "type": "frontmost_application_unless" } ], "from": { "key_code": "left_arrow", "modifiers": { - "mandatory": ["option"], + "mandatory": ["command"], "optional": ["caps_lock"] } }, "to": [ { "key_code": "left_arrow", - "modifiers": ["command"] + "modifiers": ["option"] } ], "type": "basic" @@ -145,100 +186,71 @@ "conditions": [ { "bundle_identifiers": [ - "^org\\.mozilla\\.firefox$", - "^com\\.google\\.Chrome$" + "^com\\.utmapp\\.UTM$", + "^com\\.mitchellh\\.ghostty$" ], - "type": "frontmost_application_if" + "type": "frontmost_application_unless" } ], "from": { "key_code": "right_arrow", "modifiers": { - "mandatory": ["option"], + "mandatory": ["command"], "optional": ["caps_lock"] } }, "to": [ { "key_code": "right_arrow", - "modifiers": ["command"] + "modifiers": ["option"] } ], "type": "basic" - } - ] - }, - { - "description": "Pass-Through for Cmd+Space and Ctrl+Space (Left & Right Keys)", - "manipulators": [ + }, { - "from": { - "modifiers": { "optional": ["any"] }, - "simultaneous": [ - { "key_code": "left_command" }, - { "key_code": "spacebar" } - ], - "simultaneous_options": { "detect_key_down_uninterruptedly": true } - }, - "parameters": { "basic.simultaneous_threshold_milliseconds": 300 }, - "to": [ + "conditions": [ { - "key_code": "spacebar", - "modifiers": ["left_command"] + "bundle_identifiers": [ + "^com\\.mitchellh\\.ghostty$" + ], + "type": "frontmost_application_if" } ], - "type": "basic" - }, - { "from": { - "modifiers": { "optional": ["any"] }, - "simultaneous": [ - { "key_code": "right_command" }, - { "key_code": "spacebar" } - ], - "simultaneous_options": { "detect_key_down_uninterruptedly": true } + "key_code": "left_arrow", + "modifiers": { + "mandatory": ["control"], + "optional": ["caps_lock"] + } }, - "parameters": { "basic.simultaneous_threshold_milliseconds": 300 }, "to": [ { - "key_code": "spacebar", - "modifiers": ["right_command"] + "key_code": "left_arrow", + "modifiers": ["option"] } ], "type": "basic" }, { - "from": { - "modifiers": { "optional": ["any"] }, - "simultaneous": [ - { "key_code": "left_control" }, - { "key_code": "spacebar" } - ], - "simultaneous_options": { "detect_key_down_uninterruptedly": true } - }, - "parameters": { "basic.simultaneous_threshold_milliseconds": 300 }, - "to": [ + "conditions": [ { - "key_code": "spacebar", - "modifiers": ["left_control"] + "bundle_identifiers": [ + "^com\\.mitchellh\\.ghostty$" + ], + "type": "frontmost_application_if" } ], - "type": "basic" - }, - { "from": { - "modifiers": { "optional": ["any"] }, - "simultaneous": [ - { "key_code": "right_control" }, - { "key_code": "spacebar" } - ], - "simultaneous_options": { "detect_key_down_uninterruptedly": true } + "key_code": "right_arrow", + "modifiers": { + "mandatory": ["control"], + "optional": ["caps_lock"] + } }, - "parameters": { "basic.simultaneous_threshold_milliseconds": 300 }, "to": [ { - "key_code": "spacebar", - "modifiers": ["right_control"] + "key_code": "right_arrow", + "modifiers": ["option"] } ], "type": "basic" @@ -246,47 +258,56 @@ ] }, { - "description": "Linux IT Layout: AltGr + ì produces tilde (~)", + "description": "Linux (Terminal/IDE): Ctrl+Alt+Left/Right switch Spaces (Cmd+Opt+Arrow) -- restores workspace switch where Cmd<->Ctrl swap is off (UTM intentionally excluded)", "manipulators": [ { "conditions": [ { - "input_sources": [{ "language": "^it$" }], - "type": "input_source_if" + "bundle_identifiers": [ + "^com\\.apple\\.Terminal$", + "^com\\.mitchellh\\.ghostty$", + "^com\\.jetbrains\\.[^.]+(\\.ce)?$" + ], + "type": "frontmost_application_if" } ], "from": { - "key_code": "equal_sign", - "modifiers": { "mandatory": ["right_option"] } + "key_code": "left_arrow", + "modifiers": { + "mandatory": ["control", "option"], + "optional": ["caps_lock"] + } }, "to": [ { - "key_code": "5", - "modifiers": ["option"] + "key_code": "left_arrow", + "modifiers": ["command", "option"] } ], "type": "basic" - } - ] - }, - { - "description": "Linux IT Layout: AltGr + ' produces backtick (`)", - "manipulators": [ + }, { "conditions": [ { - "input_sources": [{ "language": "^it$" }], - "type": "input_source_if" + "bundle_identifiers": [ + "^com\\.apple\\.Terminal$", + "^com\\.mitchellh\\.ghostty$", + "^com\\.jetbrains\\.[^.]+(\\.ce)?$" + ], + "type": "frontmost_application_if" } ], "from": { - "key_code": "hyphen", - "modifiers": { "mandatory": ["right_option"] } + "key_code": "right_arrow", + "modifiers": { + "mandatory": ["control", "option"], + "optional": ["caps_lock"] + } }, "to": [ { - "key_code": "grave_accent_and_tilde", - "modifiers": ["option"] + "key_code": "right_arrow", + "modifiers": ["command", "option"] } ], "type": "basic" @@ -294,29 +315,48 @@ ] }, { - "description": "Linux: Ctrl + Backspace deletes word by word", + "description": "Linux: Ctrl + Shift + Left/Right selects word by word (Option + Shift); excluded apps handle this natively", "manipulators": [ { "conditions": [ { "bundle_identifiers": [ "^com\\.utmapp\\.UTM$", - "^com\\.mitchellh\\.ghostty$" + "^com\\.apple\\.Terminal$" ], "type": "frontmost_application_unless" } ], "from": { - "key_code": "delete_or_backspace", - "modifiers": { - "mandatory": ["command"], - "optional": ["caps_lock"] + "key_code": "left_arrow", + "modifiers": { "mandatory": ["command", "shift"] } + }, + "to": [ + { + "key_code": "left_arrow", + "modifiers": ["option", "shift"] + } + ], + "type": "basic" + }, + { + "conditions": [ + { + "bundle_identifiers": [ + "^com\\.utmapp\\.UTM$", + "^com\\.apple\\.Terminal$" + ], + "type": "frontmost_application_unless" } + ], + "from": { + "key_code": "right_arrow", + "modifiers": { "mandatory": ["command", "shift"] } }, "to": [ { - "key_code": "delete_or_backspace", - "modifiers": ["option"] + "key_code": "right_arrow", + "modifiers": ["option", "shift"] } ], "type": "basic" @@ -331,37 +371,34 @@ } ], "from": { - "key_code": "delete_or_backspace", - "modifiers": { - "mandatory": ["control"], - "optional": ["caps_lock"] - } + "key_code": "left_arrow", + "modifiers": { "mandatory": ["control", "shift"] } }, "to": [ { - "key_code": "delete_or_backspace", - "modifiers": ["option"] + "key_code": "left_arrow", + "modifiers": ["option", "shift"] } ], "type": "basic" - } - ] - }, - { - "description": "Linux: Ctrl + Del (forward delete) deletes word by word", - "manipulators": [ + }, { - "from": { - "key_code": "delete_forward", - "modifiers": { - "mandatory": ["command"], - "optional": ["caps_lock"] + "conditions": [ + { + "bundle_identifiers": [ + "^com\\.mitchellh\\.ghostty$" + ], + "type": "frontmost_application_if" } + ], + "from": { + "key_code": "right_arrow", + "modifiers": { "mandatory": ["control", "shift"] } }, "to": [ { - "key_code": "delete_forward", - "modifiers": ["option"] + "key_code": "right_arrow", + "modifiers": ["option", "shift"] } ], "type": "basic" @@ -369,38 +406,57 @@ ] }, { - "description": "Linux: Ctrl + Alt + T opens Ghostty terminal", + "description": "Linux: End key moves to end of line (Command + Right); Terminal/JetBrains/UTM/Ghostty handle Home/End natively", "manipulators": [ { - "from": { - "key_code": "t", - "modifiers": { - "mandatory": ["left_command", "left_option"], - "optional": ["caps_lock"] + "conditions": [ + { + "bundle_identifiers": [ + "^com\\.apple\\.Terminal$", + "^com\\.jetbrains\\.[^.]+(\\.ce)?$", + "^com\\.utmapp\\.UTM$", + "^com\\.mitchellh\\.ghostty$" + ], + "type": "frontmost_application_unless" } + ], + "from": { + "key_code": "end", + "modifiers": { "optional": ["caps_lock"] } }, - "to": [{ "shell_command": "open -b com.mitchellh.ghostty" }], + "to": [ + { + "key_code": "right_arrow", + "modifiers": ["command"] + } + ], "type": "basic" } ] }, { - "description": "Linux Terminal: End key moves to end of line (Ctrl + E)", + "description": "Linux: Home key moves to start of line (Command + Left); Terminal/JetBrains/UTM/Ghostty handle Home/End natively", "manipulators": [ { "conditions": [ { "bundle_identifiers": [ - "^com\\.apple\\.Terminal$" + "^com\\.apple\\.Terminal$", + "^com\\.jetbrains\\.[^.]+(\\.ce)?$", + "^com\\.utmapp\\.UTM$", + "^com\\.mitchellh\\.ghostty$" ], - "type": "frontmost_application_if" + "type": "frontmost_application_unless" } ], - "from": { "key_code": "end" }, + "from": { + "key_code": "home", + "modifiers": { "optional": ["caps_lock"] } + }, "to": [ { - "key_code": "e", - "modifiers": ["control"] + "key_code": "left_arrow", + "modifiers": ["command"] } ], "type": "basic" @@ -408,22 +464,31 @@ ] }, { - "description": "Linux Terminal: Home key moves to start of line (Ctrl + A)", + "description": "Linux: Shift + End selects to end of line (Command + Shift + Right); Terminal/JetBrains/UTM/Ghostty handle Home/End natively", "manipulators": [ { "conditions": [ { "bundle_identifiers": [ - "^com\\.apple\\.Terminal$" + "^com\\.apple\\.Terminal$", + "^com\\.jetbrains\\.[^.]+(\\.ce)?$", + "^com\\.utmapp\\.UTM$", + "^com\\.mitchellh\\.ghostty$" ], - "type": "frontmost_application_if" + "type": "frontmost_application_unless" } ], - "from": { "key_code": "home" }, + "from": { + "key_code": "end", + "modifiers": { + "mandatory": ["shift"], + "optional": ["caps_lock"] + } + }, "to": [ { - "key_code": "a", - "modifiers": ["control"] + "key_code": "right_arrow", + "modifiers": ["command", "shift"] } ], "type": "basic" @@ -431,25 +496,31 @@ ] }, { - "description": "Linux Terminal: Ctrl + Backspace deletes word by word", + "description": "Linux: Shift + Home selects to start of line (Command + Shift + Left); Terminal/JetBrains/UTM/Ghostty handle Home/End natively", "manipulators": [ { "conditions": [ { "bundle_identifiers": [ - "^com\\.apple\\.Terminal$" + "^com\\.apple\\.Terminal$", + "^com\\.jetbrains\\.[^.]+(\\.ce)?$", + "^com\\.utmapp\\.UTM$", + "^com\\.mitchellh\\.ghostty$" ], - "type": "frontmost_application_if" + "type": "frontmost_application_unless" } ], "from": { - "key_code": "delete_or_backspace", - "modifiers": { "mandatory": ["control"] } + "key_code": "home", + "modifiers": { + "mandatory": ["shift"], + "optional": ["caps_lock"] + } }, "to": [ { - "key_code": "w", - "modifiers": ["control"] + "key_code": "left_arrow", + "modifiers": ["command", "shift"] } ], "type": "basic" @@ -457,7 +528,7 @@ ] }, { - "description": "Linux Terminal: Ctrl + Left/Right moves word by word", + "description": "Linux (Terminal): Home key moves to start of line (Ctrl + A) -- Apple Terminal only, other terminals handle Home natively", "manipulators": [ { "conditions": [ @@ -468,18 +539,20 @@ "type": "frontmost_application_if" } ], - "from": { - "key_code": "left_arrow", - "modifiers": { "mandatory": ["control"] } - }, + "from": { "key_code": "home" }, "to": [ { - "key_code": "left_arrow", - "modifiers": ["option"] + "key_code": "a", + "modifiers": ["control"] } ], "type": "basic" - }, + } + ] + }, + { + "description": "Linux (Terminal): End key moves to end of line (Ctrl + E) -- Apple Terminal only, other terminals handle End natively", + "manipulators": [ { "conditions": [ { @@ -489,14 +562,11 @@ "type": "frontmost_application_if" } ], - "from": { - "key_code": "right_arrow", - "modifiers": { "mandatory": ["control"] } - }, + "from": { "key_code": "end" }, "to": [ { - "key_code": "right_arrow", - "modifiers": ["option"] + "key_code": "e", + "modifiers": ["control"] } ], "type": "basic" @@ -504,29 +574,25 @@ ] }, { - "description": "Linux Terminal: Shift + Ctrl + V pastes (Command + V)", + "description": "Linux (Terminal): Ctrl + Backspace deletes word by word (Ctrl + W) -- Apple Terminal only", "manipulators": [ { "conditions": [ { "bundle_identifiers": [ - "^com\\.apple\\.Terminal$", - "^com.mitchellh.ghostty$" + "^com\\.apple\\.Terminal$" ], "type": "frontmost_application_if" } ], "from": { - "key_code": "v", - "modifiers": { - "mandatory": ["control", "shift"], - "optional": ["caps_lock"] - } + "key_code": "delete_or_backspace", + "modifiers": { "mandatory": ["control"] } }, "to": [ { - "key_code": "v", - "modifiers": ["command"] + "key_code": "w", + "modifiers": ["control"] } ], "type": "basic" @@ -534,65 +600,46 @@ ] }, { - "description": "Linux Terminal: Shift + Ctrl + C copies (Command + C)", + "description": "Linux (Terminal): Ctrl + Left/Right moves word by word (Option + Left/Right) -- Apple Terminal only", "manipulators": [ { "conditions": [ { "bundle_identifiers": [ - "^com\\.apple\\.Terminal$", - "^com.mitchellh.ghostty$" + "^com\\.apple\\.Terminal$" ], "type": "frontmost_application_if" } ], "from": { - "key_code": "c", - "modifiers": { - "mandatory": ["control", "shift"], - "optional": ["caps_lock"] - } + "key_code": "left_arrow", + "modifiers": { "mandatory": ["control"] } }, "to": [ { - "key_code": "c", - "modifiers": ["command"] + "key_code": "left_arrow", + "modifiers": ["option"] } ], "type": "basic" - } - ] - }, - { - "description": "Linux: Shift + End selects to end of line (Command + Shift + Right)", - "manipulators": [ + }, { "conditions": [ { "bundle_identifiers": [ - "^com\\.apple\\.Terminal$", - "^com\\.jetbrains\\.intellij$", - "^com\\.jetbrains\\.intellij\\.ce$", - "^com\\.jetbrains\\.pycharm$", - "^com\\.jetbrains\\.pycharm\\.ce$", - "^com\\.jetbrains\\.goland$", - "^com\\.utmapp\\.UTM$", - "^com\\.mitchellh\\.ghostty$" + "^com\\.apple\\.Terminal$" ], - "type": "frontmost_application_unless" + "type": "frontmost_application_if" } ], "from": { - "key_code": "end", - "modifiers": { - "mandatory": ["shift"], - "optional": ["caps_lock"] - } + "key_code": "right_arrow", + "modifiers": { "mandatory": ["control"] } }, "to": [ { "key_code": "right_arrow", - "modifiers": ["command", "shift"] + "modifiers": ["option"] } ], "type": "basic" @@ -600,35 +647,29 @@ ] }, { - "description": "Linux: Shift + Home selects to start of line (Command + Shift + Left)", + "description": "Linux (Terminal): Shift + Ctrl + C copies (Command + C) -- Apple Terminal & Ghostty", "manipulators": [ { "conditions": [ { "bundle_identifiers": [ "^com\\.apple\\.Terminal$", - "^com\\.jetbrains\\.intellij$", - "^com\\.jetbrains\\.intellij\\.ce$", - "^com\\.jetbrains\\.pycharm$", - "^com\\.jetbrains\\.pycharm\\.ce$", - "^com\\.jetbrains\\.goland$", - "^com\\.utmapp\\.UTM$", "^com\\.mitchellh\\.ghostty$" ], - "type": "frontmost_application_unless" + "type": "frontmost_application_if" } ], "from": { - "key_code": "home", + "key_code": "c", "modifiers": { - "mandatory": ["shift"], + "mandatory": ["control", "shift"], "optional": ["caps_lock"] } }, "to": [ { - "key_code": "left_arrow", - "modifiers": ["command", "shift"] + "key_code": "c", + "modifiers": ["command"] } ], "type": "basic" @@ -636,31 +677,28 @@ ] }, { - "description": "Linux: End key moves to end of line (Command + Right)", + "description": "Linux (Terminal): Shift + Ctrl + V pastes (Command + V) -- Apple Terminal & Ghostty", "manipulators": [ { "conditions": [ { "bundle_identifiers": [ "^com\\.apple\\.Terminal$", - "^com\\.jetbrains\\.intellij$", - "^com\\.jetbrains\\.intellij\\.ce$", - "^com\\.jetbrains\\.pycharm$", - "^com\\.jetbrains\\.pycharm\\.ce$", - "^com\\.jetbrains\\.goland$", - "^com\\.utmapp\\.UTM$", - "^com.mitchellh.ghostty$" + "^com\\.mitchellh\\.ghostty$" ], - "type": "frontmost_application_unless" + "type": "frontmost_application_if" } ], "from": { - "key_code": "end", - "modifiers": { "optional": ["caps_lock"] } + "key_code": "v", + "modifiers": { + "mandatory": ["control", "shift"], + "optional": ["caps_lock"] + } }, "to": [ { - "key_code": "right_arrow", + "key_code": "v", "modifiers": ["command"] } ], @@ -669,32 +707,25 @@ ] }, { - "description": "Linux: Home key moves to start of line (Command + Left)", + "description": "Linux (Browsers): F5 reloads page (Command + R) -- Firefox/Zen intentionally omitted, F5 already reloads natively there", "manipulators": [ { "conditions": [ { "bundle_identifiers": [ - "^com\\.apple\\.Terminal$", - "^com\\.jetbrains\\.intellij$", - "^com\\.jetbrains\\.intellij\\.ce$", - "^com\\.jetbrains\\.pycharm$", - "^com\\.jetbrains\\.pycharm\\.ce$", - "^com\\.jetbrains\\.goland$", - "^com\\.utmapp\\.UTM$", - "^com.mitchellh.ghostty$" + "^com\\.microsoft\\.edgemac$", + "^com\\.google\\.Chrome$", + "^com\\.brave\\.Browser$", + "^com\\.apple\\.Safari$" ], - "type": "frontmost_application_unless" + "type": "frontmost_application_if" } ], - "from": { - "key_code": "home", - "modifiers": { "optional": ["caps_lock"] } - }, + "from": { "key_code": "f5" }, "to": [ { - "key_code": "left_arrow", - "modifiers": ["command"] + "key_code": "r", + "modifiers": ["left_command"] } ], "type": "basic" @@ -702,26 +733,33 @@ ] }, { - "description": "Linux: Ctrl + Shift + Left/Right selects word by word", + "description": "Linux (Browsers): Option + Left/Right Arrow navigates history (Command + Left/Right)", "manipulators": [ { "conditions": [ { "bundle_identifiers": [ - "^com\\.utmapp\\.UTM$", - "^com\\.apple\\.Terminal$" + "^org\\.mozilla\\.firefox$", + "^com\\.google\\.Chrome$", + "^com\\.apple\\.Safari$", + "^com\\.brave\\.Browser$", + "^com\\.microsoft\\.edgemac$", + "^app\\.zen-browser\\.zen$" ], - "type": "frontmost_application_unless" + "type": "frontmost_application_if" } ], "from": { "key_code": "left_arrow", - "modifiers": { "mandatory": ["command", "shift"] } + "modifiers": { + "mandatory": ["option"], + "optional": ["caps_lock"] + } }, "to": [ { "key_code": "left_arrow", - "modifiers": ["option", "shift"] + "modifiers": ["command"] } ], "type": "basic" @@ -730,41 +768,64 @@ "conditions": [ { "bundle_identifiers": [ - "^com\\.utmapp\\.UTM$", - "^com\\.apple\\.Terminal$" + "^org\\.mozilla\\.firefox$", + "^com\\.google\\.Chrome$", + "^com\\.apple\\.Safari$", + "^com\\.brave\\.Browser$", + "^com\\.microsoft\\.edgemac$", + "^app\\.zen-browser\\.zen$" ], - "type": "frontmost_application_unless" + "type": "frontmost_application_if" } ], "from": { "key_code": "right_arrow", - "modifiers": { "mandatory": ["command", "shift"] } + "modifiers": { + "mandatory": ["option"], + "optional": ["caps_lock"] + } }, "to": [ { "key_code": "right_arrow", - "modifiers": ["option", "shift"] + "modifiers": ["command"] } ], "type": "basic" - }, + } + ] + }, + { + "description": "Linux (Finder): F2 renames files and Enter opens files", + "manipulators": [ { "conditions": [ { "bundle_identifiers": [ - "^com\\.mitchellh\\.ghostty$" + "^com\\.apple\\.finder$" ], "type": "frontmost_application_if" } ], "from": { - "key_code": "left_arrow", - "modifiers": { "mandatory": ["control", "shift"] } + "key_code": "f2", + "modifiers": { "optional": ["any"] } }, "to": [ { - "key_code": "left_arrow", - "modifiers": ["option", "shift"] + "set_variable": { + "name": "rename_from_f2", + "value": 1 + } + }, + { "key_code": "return_or_enter" } + ], + "to_after_key_up": [ + { + "set_variable": { + "name": "rename_from_f2", + "value": 0 + } } ], "type": "basic" @@ -773,19 +834,24 @@ "conditions": [ { "bundle_identifiers": [ - "^com\\.mitchellh\\.ghostty$" + "^com\\.apple\\.finder$" ], "type": "frontmost_application_if" + }, + { + "name": "rename_from_f2", + "type": "variable_unless", + "value": 1 } ], "from": { - "key_code": "right_arrow", - "modifiers": { "mandatory": ["control", "shift"] } + "key_code": "return_or_enter", + "modifiers": { "optional": ["any"] } }, "to": [ { - "key_code": "right_arrow", - "modifiers": ["option", "shift"] + "key_code": "down_arrow", + "modifiers": ["command"] } ], "type": "basic" @@ -793,102 +859,113 @@ ] }, { - "description": "Linux: Ctrl + Left/Right => Option + Left/Right", + "description": "Linux: Option + F4 quits the frontmost application (Command + Q)", "manipulators": [ { - "conditions": [ - { - "bundle_identifiers": [ - "^com\\.utmapp\\.UTM$", - "^com\\.mitchellh\\.ghostty$" - ], - "type": "frontmost_application_unless" - } - ], "from": { - "key_code": "left_arrow", + "key_code": "f4", "modifiers": { - "mandatory": ["command"], + "mandatory": ["option"], "optional": ["caps_lock"] } }, "to": [ { - "key_code": "left_arrow", - "modifiers": ["option"] + "key_code": "q", + "modifiers": ["command"] } ], "type": "basic" - }, + } + ] + }, + { + "description": "Linux: Ctrl + Alt + T opens Ghostty terminal", + "manipulators": [ { - "conditions": [ - { - "bundle_identifiers": [ - "^com\\.utmapp\\.UTM$", - "^com\\.mitchellh\\.ghostty$" - ], - "type": "frontmost_application_unless" - } - ], "from": { - "key_code": "right_arrow", + "key_code": "t", "modifiers": { - "mandatory": ["command"], + "mandatory": ["left_command", "left_option"], "optional": ["caps_lock"] } }, + "to": [{ "shell_command": "open -b com.mitchellh.ghostty" }], + "type": "basic" + } + ] + }, + { + "description": "Pass-through: Cmd+Space and Ctrl+Space (both left & right keys) stay untouched by the Cmd<->Ctrl swap below", + "manipulators": [ + { + "from": { + "modifiers": { "optional": ["any"] }, + "simultaneous": [ + { "key_code": "left_command" }, + { "key_code": "spacebar" } + ], + "simultaneous_options": { "detect_key_down_uninterruptedly": true } + }, + "parameters": { "basic.simultaneous_threshold_milliseconds": 300 }, "to": [ { - "key_code": "right_arrow", - "modifiers": ["option"] + "key_code": "spacebar", + "modifiers": ["left_command"] } ], "type": "basic" }, { - "conditions": [ - { - "bundle_identifiers": [ - "^com\\.mitchellh\\.ghostty$" - ], - "type": "frontmost_application_if" - } - ], "from": { - "key_code": "left_arrow", - "modifiers": { - "mandatory": ["control"], - "optional": ["caps_lock"] - } + "modifiers": { "optional": ["any"] }, + "simultaneous": [ + { "key_code": "right_command" }, + { "key_code": "spacebar" } + ], + "simultaneous_options": { "detect_key_down_uninterruptedly": true } }, + "parameters": { "basic.simultaneous_threshold_milliseconds": 300 }, "to": [ { - "key_code": "left_arrow", - "modifiers": ["option"] + "key_code": "spacebar", + "modifiers": ["right_command"] } ], "type": "basic" }, { - "conditions": [ + "from": { + "modifiers": { "optional": ["any"] }, + "simultaneous": [ + { "key_code": "left_control" }, + { "key_code": "spacebar" } + ], + "simultaneous_options": { "detect_key_down_uninterruptedly": true } + }, + "parameters": { "basic.simultaneous_threshold_milliseconds": 300 }, + "to": [ { - "bundle_identifiers": [ - "^com\\.mitchellh\\.ghostty$" - ], - "type": "frontmost_application_if" + "key_code": "spacebar", + "modifiers": ["left_control"] } ], + "type": "basic" + }, + { "from": { - "key_code": "right_arrow", - "modifiers": { - "mandatory": ["control"], - "optional": ["caps_lock"] - } + "modifiers": { "optional": ["any"] }, + "simultaneous": [ + { "key_code": "right_control" }, + { "key_code": "spacebar" } + ], + "simultaneous_options": { "detect_key_down_uninterruptedly": true } }, + "parameters": { "basic.simultaneous_threshold_milliseconds": 300 }, "to": [ { - "key_code": "right_arrow", - "modifiers": ["option"] + "key_code": "spacebar", + "modifiers": ["right_control"] } ], "type": "basic" @@ -896,20 +973,16 @@ ] }, { - "description": "Linux: Swap Left & Right Command and Control (excluding certain apps)", + "description": "Linux: Swap Left & Right Command and Control (excluding Terminal/JetBrains/UTM/Ghostty) -- MUST STAY LAST: remaps physical modifier keys, every rule above matches against the un-swapped ones", "manipulators": [ { "conditions": [ { "bundle_identifiers": [ "^com\\.apple\\.Terminal$", - "^com\\.jetbrains\\.intellij$", - "^com\\.jetbrains\\.intellij\\.ce$", - "^com\\.jetbrains\\.pycharm$", - "^com\\.jetbrains\\.pycharm\\.ce$", - "^com\\.jetbrains\\.goland$", + "^com\\.jetbrains\\.[^.]+(\\.ce)?$", "^com\\.utmapp\\.UTM$", - "^com.mitchellh.ghostty$" + "^com\\.mitchellh\\.ghostty$" ], "type": "frontmost_application_unless" } @@ -926,13 +999,9 @@ { "bundle_identifiers": [ "^com\\.apple\\.Terminal$", - "^com\\.jetbrains\\.intellij$", - "^com\\.jetbrains\\.intellij\\.ce$", - "^com\\.jetbrains\\.pycharm$", - "^com\\.jetbrains\\.pycharm\\.ce$", - "^com\\.jetbrains\\.goland$", + "^com\\.jetbrains\\.[^.]+(\\.ce)?$", "^com\\.utmapp\\.UTM$", - "^com.mitchellh.ghostty$" + "^com\\.mitchellh\\.ghostty$" ], "type": "frontmost_application_unless" } @@ -949,13 +1018,9 @@ { "bundle_identifiers": [ "^com\\.apple\\.Terminal$", - "^com\\.jetbrains\\.intellij$", - "^com\\.jetbrains\\.intellij\\.ce$", - "^com\\.jetbrains\\.pycharm$", - "^com\\.jetbrains\\.pycharm\\.ce$", - "^com\\.jetbrains\\.goland$", + "^com\\.jetbrains\\.[^.]+(\\.ce)?$", "^com\\.utmapp\\.UTM$", - "^com.mitchellh.ghostty$" + "^com\\.mitchellh\\.ghostty$" ], "type": "frontmost_application_unless" } @@ -972,13 +1037,9 @@ { "bundle_identifiers": [ "^com\\.apple\\.Terminal$", - "^com\\.jetbrains\\.intellij$", - "^com\\.jetbrains\\.intellij\\.ce$", - "^com\\.jetbrains\\.pycharm$", - "^com\\.jetbrains\\.pycharm\\.ce$", - "^com\\.jetbrains\\.goland$", + "^com\\.jetbrains\\.[^.]+(\\.ce)?$", "^com\\.utmapp\\.UTM$", - "^com.mitchellh.ghostty$" + "^com\\.mitchellh\\.ghostty$" ], "type": "frontmost_application_unless" } @@ -1003,4 +1064,4 @@ "virtual_hid_keyboard": { "keyboard_type_v2": "iso" } } ] -} \ No newline at end of file +}