diff --git a/README.md b/README.md index bdf5057..05ecb9a 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ From your users home directory (~/), execute: To install oh-my-zsh and symlink the config files run: ```sh .config/dotfiles/install.sh``` -This replaces the managed dotfiles in your home directory (`.zshrc`, `.zprofile`, `.gitconfig`, `.p10k.zsh`, `~/.config/kitty`, `~/.config/nvim`, and `~/.config/tmux`). On macOS it also links `~/.config/karabiner`. +This replaces the managed dotfiles in your home directory (`.zshrc`, `.zprofile`, `.gitconfig`, `.p10k.zsh`, `~/.config/kitty`, `~/.config/nvim`, and `~/.config/tmux`). On macOS it also links `~/.config/karabiner/karabiner.json` and `~/.config/karabiner/assets`, while leaving Karabiner's local backup files unmanaged. ![user prompt](https://24unix.net/build/images/Settings/user_screen.png) [original image, 1.8M](https://24unix.net/build/images/Settings/user_screen_original.png) diff --git a/install.sh b/install.sh index 86a92cf..3d6d30c 100755 --- a/install.sh +++ b/install.sh @@ -103,7 +103,7 @@ apply_dotfiles() { link_dotfile "$DOTFILES_DIR/nvim" "$HOME/.config/nvim" link_dotfile "$DOTFILES_DIR/tmux" "$HOME/.config/tmux" if [ "$(uname -s)" = "Darwin" ]; then - link_dotfile "$DOTFILES_DIR/karabiner" "$HOME/.config/karabiner" + install_karabiner_config fi install_kitty_icon install_tmux_plugins @@ -152,6 +152,12 @@ link_dotfile() { echo "${GREEN}Linked $target_path -> $source_path${RESET}" } +install_karabiner_config() { + mkdir -p "$HOME/.config/karabiner" + link_dotfile "$DOTFILES_DIR/karabiner/karabiner.json" "$HOME/.config/karabiner/karabiner.json" + link_dotfile "$DOTFILES_DIR/karabiner/assets" "$HOME/.config/karabiner/assets" +} + install_kitty_icon() { icon_path="$DOTFILES_DIR/kitty/kitty.app.png" diff --git a/karabiner/karabiner.json b/karabiner/karabiner.json index faba434..4bef48c 100644 --- a/karabiner/karabiner.json +++ b/karabiner/karabiner.json @@ -1,9 +1,75 @@ { "profiles": [ { + "complex_modifications": { + "rules": [ + { + "description": "kitty: map cmd+left/right to ctrl+left/right", + "manipulators": [ + { + "conditions": [ + { + "bundle_identifiers": [ + "^net\\.kovidgoyal\\.kitty$" + ], + "type": "frontmost_application_if" + } + ], + "from": { + "key_code": "left_arrow", + "modifiers": { + "mandatory": ["command"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "left_arrow", + "modifiers": ["control"] + } + ], + "type": "basic" + }, + { + "conditions": [ + { + "bundle_identifiers": [ + "^net\\.kovidgoyal\\.kitty$" + ], + "type": "frontmost_application_if" + } + ], + "from": { + "key_code": "right_arrow", + "modifiers": { + "mandatory": ["command"], + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "right_arrow", + "modifiers": ["control"] + } + ], + "type": "basic" + } + ] + } + ] + }, + "fn_function_keys": [ + { + "from": { "key_code": "f6" }, + "to": [{ "key_code": "f6" }] + } + ], "name": "Default profile", "selected": true, - "virtual_hid_keyboard": { "keyboard_type_v2": "ansi" } + "virtual_hid_keyboard": { + "country_code": 0, + "keyboard_type_v2": "ansi" + } } ] }