From 87fcd9fd6bafa0cf2cd7781d555bdf354b6979ce Mon Sep 17 00:00:00 2001 From: clux Date: Mon, 20 Jan 2025 16:39:54 +0000 Subject: [PATCH] mac: key bind restructure - avoid aerospace stealing zellij binds - avoid zellij stealing helix binds - migrate karabiner config - avoid use of global modifier binds in mac (rely on karabiner cfg) Signed-off-by: clux --- .zshenv | 2 +- config/aerospace/aerospace.toml | 10 +- config/karabiner/karabiner.json | 497 +++----------------------------- config/zellij/config.kdl | 12 +- 4 files changed, 46 insertions(+), 475 deletions(-) diff --git a/.zshenv b/.zshenv index 4b09bee..a1449cd 100755 --- a/.zshenv +++ b/.zshenv @@ -17,7 +17,7 @@ export FZF_ALT_C_COMMAND="fd --type d --strip-cwd-prefix -HE='.git'" _fzf_compgen_path() { fd -HE='.git' . "$1"; } _fzf_compgen_gir() { fd --type=d -HE='.git' . "$1"; } _FZF_LAYOUT='--height 50% --layout=reverse' -eval "$(fzf --zsh)" +#eval "$(fzf --zsh)" # fzf theme; catppuccin mocha: https://github.com/catppuccin/fzf but no bg export FZF_DEFAULT_OPTS="${_FZF_LAYOUT} \ diff --git a/config/aerospace/aerospace.toml b/config/aerospace/aerospace.toml index cc483ed..32fc759 100644 --- a/config/aerospace/aerospace.toml +++ b/config/aerospace/aerospace.toml @@ -89,10 +89,12 @@ alt-slash = 'layout tiles horizontal vertical' alt-comma = 'layout accordion horizontal vertical' # See: https://nikitabobko.github.io/AeroSpace/commands#focus -alt-left = 'focus left' -alt-down = 'focus down' -alt-up = 'focus up' -alt-right = 'focus right' +# NB: don't use alt-arrows to preserve zellij tab movement +# NB: this ends up being ctrl-{arrows} with remap +cmd-left = 'focus left' +cmd-down = 'focus down' +cmd-up = 'focus up' +cmd-right = 'focus right' # See: https://nikitabobko.github.io/AeroSpace/commands#move alt-shift-left = 'move left' diff --git a/config/karabiner/karabiner.json b/config/karabiner/karabiner.json index 008e884..e62ac06 100644 --- a/config/karabiner/karabiner.json +++ b/config/karabiner/karabiner.json @@ -1,21 +1,7 @@ { - "global": { - "ask_for_confirmation_before_quitting": true, - "check_for_updates_on_startup": true, - "show_in_menu_bar": true, - "show_profile_name_in_menu_bar": false, - "unsafe_ui": false - }, "profiles": [ { "complex_modifications": { - "parameters": { - "basic.simultaneous_threshold_milliseconds": 50, - "basic.to_delayed_action_delay_milliseconds": 500, - "basic.to_if_alone_timeout_milliseconds": 1000, - "basic.to_if_held_down_threshold_milliseconds": 500, - "mouse_motion_to_scroll.speed": 100 - }, "rules": [ { "description": "Map Control_Shift + C/V to copy/paste in term (ala Linux)", @@ -38,21 +24,14 @@ "from": { "key_code": "c", "modifiers": { - "mandatory": [ - "control", - "left_shift" - ], - "optional": [ - "any" - ] + "mandatory": ["control", "left_shift"], + "optional": ["any"] } }, "to": [ { "key_code": "c", - "modifiers": [ - "command" - ] + "modifiers": ["command"] } ], "type": "basic" @@ -75,21 +54,14 @@ "from": { "key_code": "v", "modifiers": { - "mandatory": [ - "control", - "left_shift" - ], - "optional": [ - "any" - ] + "mandatory": ["control", "left_shift"], + "optional": ["any"] } }, "to": [ { "key_code": "v", - "modifiers": [ - "command" - ] + "modifiers": ["command"] } ], "type": "basic" @@ -110,18 +82,12 @@ ], "from": { "key_code": "tab", - "modifiers": { - "mandatory": [ - "control" - ] - } + "modifiers": { "mandatory": ["control"] } }, "to": [ { "key_code": "tab", - "modifiers": [ - "command" - ] + "modifiers": ["command"] } ], "type": "basic" @@ -137,18 +103,12 @@ ], "from": { "key_code": "tab", - "modifiers": { - "mandatory": [ - "command" - ] - } + "modifiers": { "mandatory": ["command"] } }, "to": [ { "key_code": "tab", - "modifiers": [ - "control" - ] + "modifiers": ["control"] } ], "type": "basic" @@ -164,20 +124,12 @@ ], "from": { "key_code": "tab", - "modifiers": { - "mandatory": [ - "control", - "left_shift" - ] - } + "modifiers": { "mandatory": ["control", "left_shift"] } }, "to": [ { "key_code": "tab", - "modifiers": [ - "command", - "left_shift" - ] + "modifiers": ["command", "left_shift"] } ], "type": "basic" @@ -193,20 +145,12 @@ ], "from": { "key_code": "tab", - "modifiers": { - "mandatory": [ - "command", - "left_shift" - ] - } + "modifiers": { "mandatory": ["command", "left_shift"] } }, "to": [ { "key_code": "tab", - "modifiers": [ - "control", - "left_shift" - ] + "modifiers": ["control", "left_shift"] } ], "type": "basic" @@ -231,14 +175,8 @@ "type": "frontmost_application_if" } ], - "from": { - "key_code": "left_control" - }, - "to": [ - { - "key_code": "left_command" - } - ], + "from": { "key_code": "left_control" }, + "to": [{ "key_code": "left_command" }], "type": "basic" }, { @@ -256,14 +194,8 @@ "type": "frontmost_application_if" } ], - "from": { - "key_code": "left_command" - }, - "to": [ - { - "key_code": "left_control" - } - ], + "from": { "key_code": "left_command" }, + "to": [{ "key_code": "left_control" }], "type": "basic" } ] @@ -272,432 +204,71 @@ }, "devices": [ { - "disable_built_in_keyboard_if_exists": false, - "fn_function_keys": [], "identifiers": { "is_keyboard": true, - "is_pointing_device": false, "product_id": 834, "vendor_id": 1452 }, - "ignore": false, - "manipulate_caps_lock_led": true, "simple_modifications": [ { - "from": { - "key_code": "grave_accent_and_tilde" - }, - "to": [ - { - "key_code": "non_us_backslash" - } - ] + "from": { "key_code": "grave_accent_and_tilde" }, + "to": [{ "key_code": "non_us_backslash" }] }, { - "from": { - "key_code": "non_us_backslash" - }, - "to": [ - { - "key_code": "grave_accent_and_tilde" - } - ] + "from": { "key_code": "non_us_backslash" }, + "to": [{ "key_code": "grave_accent_and_tilde" }] } - ], - "treat_as_built_in_keyboard": false - }, - { - "disable_built_in_keyboard_if_exists": false, - "fn_function_keys": [], - "identifiers": { - "is_keyboard": false, - "is_pointing_device": true, - "product_id": 834, - "vendor_id": 1452 - }, - "ignore": true, - "manipulate_caps_lock_led": false, - "simple_modifications": [], - "treat_as_built_in_keyboard": false - }, - { - "disable_built_in_keyboard_if_exists": false, - "fn_function_keys": [], - "identifiers": { - "is_keyboard": true, - "is_pointing_device": true, - "product_id": 7004, - "vendor_id": 6940 - }, - "ignore": true, - "manipulate_caps_lock_led": true, - "simple_modifications": [], - "treat_as_built_in_keyboard": false + ] }, { - "disable_built_in_keyboard_if_exists": false, - "fn_function_keys": [], "identifiers": { "is_keyboard": true, - "is_pointing_device": false, "product_id": 258, "vendor_id": 12046 }, - "ignore": false, - "manipulate_caps_lock_led": true, "simple_modifications": [ { - "from": { - "key_code": "left_command" - }, - "to": [ - { - "key_code": "left_control" - } - ] + "from": { "key_code": "left_command" }, + "to": [{ "key_code": "left_control" }] }, { - "from": { - "key_code": "left_control" - }, - "to": [ - { - "key_code": "left_command" - } - ] - } - ], - "treat_as_built_in_keyboard": false - } - ], - "fn_function_keys": [ - { - "from": { - "key_code": "f1" - }, - "to": [ - { - "consumer_key_code": "display_brightness_decrement" - } - ] - }, - { - "from": { - "key_code": "f2" - }, - "to": [ - { - "consumer_key_code": "display_brightness_increment" - } - ] - }, - { - "from": { - "key_code": "f3" - }, - "to": [ - { - "apple_vendor_keyboard_key_code": "mission_control" - } - ] - }, - { - "from": { - "key_code": "f4" - }, - "to": [ - { - "apple_vendor_keyboard_key_code": "spotlight" - } - ] - }, - { - "from": { - "key_code": "f5" - }, - "to": [ - { - "consumer_key_code": "dictation" - } - ] - }, - { - "from": { - "key_code": "f6" - }, - "to": [ - { - "key_code": "f6" - } - ] - }, - { - "from": { - "key_code": "f7" - }, - "to": [ - { - "consumer_key_code": "rewind" - } - ] - }, - { - "from": { - "key_code": "f8" - }, - "to": [ - { - "consumer_key_code": "play_or_pause" - } - ] - }, - { - "from": { - "key_code": "f9" - }, - "to": [ - { - "consumer_key_code": "fast_forward" - } - ] - }, - { - "from": { - "key_code": "f10" - }, - "to": [ - { - "consumer_key_code": "mute" - } - ] - }, - { - "from": { - "key_code": "f11" - }, - "to": [ - { - "consumer_key_code": "volume_decrement" - } - ] - }, - { - "from": { - "key_code": "f12" - }, - "to": [ - { - "consumer_key_code": "volume_increment" + "from": { "key_code": "left_control" }, + "to": [{ "key_code": "left_command" }] } ] } ], "name": "Default profile", - "parameters": { - "delay_milliseconds_before_open_device": 1000 - }, - "selected": false, - "simple_modifications": [], + "selected": true, "virtual_hid_keyboard": { "country_code": 0, - "indicate_sticky_modifier_keys_state": true, - "mouse_key_xy_scale": 100 + "keyboard_type_v2": "ansi" } }, { - "complex_modifications": { - "parameters": { - "basic.simultaneous_threshold_milliseconds": 50, - "basic.to_delayed_action_delay_milliseconds": 500, - "basic.to_if_alone_timeout_milliseconds": 1000, - "basic.to_if_held_down_threshold_milliseconds": 500, - "mouse_motion_to_scroll.speed": 100 - }, - "rules": [] - }, "devices": [ { - "disable_built_in_keyboard_if_exists": false, - "fn_function_keys": [], "identifiers": { "is_keyboard": true, - "is_pointing_device": false, "product_id": 834, "vendor_id": 1452 }, - "ignore": false, - "manipulate_caps_lock_led": true, "simple_modifications": [ { - "from": { - "key_code": "grave_accent_and_tilde" - }, - "to": [ - { - "key_code": "non_us_backslash" - } - ] + "from": { "key_code": "grave_accent_and_tilde" }, + "to": [{ "key_code": "non_us_backslash" }] }, { - "from": { - "key_code": "non_us_backslash" - }, - "to": [ - { - "key_code": "grave_accent_and_tilde" - } - ] - } - ], - "treat_as_built_in_keyboard": false - }, - { - "disable_built_in_keyboard_if_exists": false, - "fn_function_keys": [], - "identifiers": { - "is_keyboard": false, - "is_pointing_device": true, - "product_id": 834, - "vendor_id": 1452 - }, - "ignore": true, - "manipulate_caps_lock_led": false, - "simple_modifications": [], - "treat_as_built_in_keyboard": false - } - ], - "fn_function_keys": [ - { - "from": { - "key_code": "f1" - }, - "to": [ - { - "consumer_key_code": "display_brightness_decrement" - } - ] - }, - { - "from": { - "key_code": "f2" - }, - "to": [ - { - "consumer_key_code": "display_brightness_increment" - } - ] - }, - { - "from": { - "key_code": "f3" - }, - "to": [ - { - "apple_vendor_keyboard_key_code": "mission_control" - } - ] - }, - { - "from": { - "key_code": "f4" - }, - "to": [ - { - "apple_vendor_keyboard_key_code": "spotlight" - } - ] - }, - { - "from": { - "key_code": "f5" - }, - "to": [ - { - "consumer_key_code": "dictation" - } - ] - }, - { - "from": { - "key_code": "f6" - }, - "to": [ - { - "key_code": "f6" - } - ] - }, - { - "from": { - "key_code": "f7" - }, - "to": [ - { - "consumer_key_code": "rewind" - } - ] - }, - { - "from": { - "key_code": "f8" - }, - "to": [ - { - "consumer_key_code": "play_or_pause" - } - ] - }, - { - "from": { - "key_code": "f9" - }, - "to": [ - { - "consumer_key_code": "fast_forward" - } - ] - }, - { - "from": { - "key_code": "f10" - }, - "to": [ - { - "consumer_key_code": "mute" - } - ] - }, - { - "from": { - "key_code": "f11" - }, - "to": [ - { - "consumer_key_code": "volume_decrement" - } - ] - }, - { - "from": { - "key_code": "f12" - }, - "to": [ - { - "consumer_key_code": "volume_increment" + "from": { "key_code": "non_us_backslash" }, + "to": [{ "key_code": "grave_accent_and_tilde" }] } ] } ], "name": "standalone-without-ctrl-cmd", - "parameters": { - "delay_milliseconds_before_open_device": 1000 - }, - "selected": true, - "simple_modifications": [], "virtual_hid_keyboard": { "country_code": 0, - "indicate_sticky_modifier_keys_state": true, - "mouse_key_xy_scale": 100 + "keyboard_type_v2": "ansi" } } ] diff --git a/config/zellij/config.kdl b/config/zellij/config.kdl index ba58b2b..f948645 100644 --- a/config/zellij/config.kdl +++ b/config/zellij/config.kdl @@ -130,13 +130,11 @@ keybinds clear-defaults=true { // main binds that work everywhere shared_except "locked" { // normal mode binds; home row, movement bind "Ctrl g" { SwitchToMode "locked"; } - // Trying without this to avoid interfering with helix - // simple focus left right (try pane first, then tab) - bind "Alt Left" { MoveFocusOrTab "Left"; } - bind "Alt Right" { MoveFocusOrTab "Right"; } - // simple pane focus up/dn - bind "Alt Down" { MoveFocus "Down"; } - bind "Alt Up" { MoveFocus "Up"; } + // Carefully take arrow key binds that are not super common to avoid stealing a common helix bind + bind "Ctrl Alt Left" { MoveFocusOrTab "Left"; } + bind "Ctrl Alt Right" { MoveFocusOrTab "Right"; } + bind "Ctrl Alt Down" { MoveFocus "Down"; } + bind "Ctrl Alt Up" { MoveFocus "Up"; } // cheaper resize than the full resize mode (unbound - i seem to prefer resize mode) //bind "Alt =" "Alt +" { Resize "Increase"; } //bind "Alt -" { Resize "Decrease"; }