diff --git a/.gitignore b/.gitignore index 17735df..56aba49 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store home/.config/lazygit/state.yml neomuttrc.local +karabiner/automatic_backups/ result diff --git a/karabiner/karabiner.json b/karabiner/karabiner.json new file mode 100644 index 0000000..c34f41e --- /dev/null +++ b/karabiner/karabiner.json @@ -0,0 +1,194 @@ +{ + "global": { "check_for_updates_on_startup": false }, + "profiles": [ + { + "complex_modifications": { + "rules": [ + { + "description": "Map Cmd+h/j/k/l to Cmd+ArrowKeys and Ctrl+h/j/k/l to original Cmd+h/j/k/l", + "manipulators": [ + { + "from": { + "key_code": "h", + "modifiers": { + "mandatory": ["command"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "left_arrow", + "modifiers": ["command"] + } + ], + "type": "basic" + }, + { + "from": { + "key_code": "h", + "modifiers": { + "mandatory": ["control"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "h", + "modifiers": ["command"] + } + ], + "type": "basic" + }, + { + "from": { + "key_code": "j", + "modifiers": { + "mandatory": ["command"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "down_arrow", + "modifiers": ["command"] + } + ], + "type": "basic" + }, + { + "from": { + "key_code": "j", + "modifiers": { + "mandatory": ["control"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "j", + "modifiers": ["command"] + } + ], + "type": "basic" + }, + { + "from": { + "key_code": "k", + "modifiers": { + "mandatory": ["command"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "up_arrow", + "modifiers": ["command"] + } + ], + "type": "basic" + }, + { + "from": { + "key_code": "k", + "modifiers": { + "mandatory": ["control"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "k", + "modifiers": ["command"] + } + ], + "type": "basic" + }, + { + "from": { + "key_code": "l", + "modifiers": { + "mandatory": ["command"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "right_arrow", + "modifiers": ["command"] + } + ], + "type": "basic" + }, + { + "from": { + "key_code": "l", + "modifiers": { + "mandatory": ["control"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "l", + "modifiers": ["command"] + } + ], + "type": "basic" + } + ] + }, + { + "description": "Caps Lock → Control when held, Escape when tapped", + "manipulators": [ + { + "from": { + "key_code": "caps_lock", + "modifiers": { "optional": ["any"] } + }, + "to": [{ "key_code": "left_control" }], + "to_if_alone": [{ "key_code": "escape" }], + "type": "basic" + } + ] + }, + { + "description": "Escape ↔ Caps Lock toggle", + "manipulators": [ + { + "type": "basic", + "from": { + "key_code": "escape", + "modifiers": { + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "caps_lock" + } + ] + }, + { + "type": "basic", + "from": { + "key_code": "escape", + "modifiers": { + "mandatory": ["shift"] + } + }, + "to": [ + { + "key_code": "caps_lock" + } + ] + } + ] + } + ] + }, + "name": "Default profile", + "selected": true, + "virtual_hid_keyboard": { "keyboard_type_v2": "iso" } + } + ] +} diff --git a/nix/home/darwin.nix b/nix/home/darwin.nix index 3658996..b2b08b1 100644 --- a/nix/home/darwin.nix +++ b/nix/home/darwin.nix @@ -11,6 +11,10 @@ let ".config/aerospace" "aerospace" ] + [ + ".config/karabiner" + "karabiner" + ] ]; in { diff --git a/nix/system/darwin.nix b/nix/system/darwin.nix index 44e7110..07e2ef2 100644 --- a/nix/system/darwin.nix +++ b/nix/system/darwin.nix @@ -19,6 +19,7 @@ in enable = true; casks = [ "ghostty" + "karabiner-elements" ]; brews = [ "bitwarden-cli" @@ -66,7 +67,7 @@ in keyboard = { enableKeyMapping = true; nonUS.remapTilde = true; - remapCapsLockToEscape = true; + remapCapsLockToEscape = false; # This is set to false as we leave this for Karabiner (mod tap with ctrl) swapLeftCtrlAndFn = false; };