Manage Karabiner config from dotfiles

This commit is contained in:
2026-03-29 17:43:02 +02:00
parent 6e541cfece
commit bdb54822b0
3 changed files with 75 additions and 3 deletions

View File

@@ -14,7 +14,7 @@ From your users home directory (~/), execute:
To install oh-my-zsh and symlink the config files run: To install oh-my-zsh and symlink the config files run:
```sh .config/dotfiles/install.sh``` ```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) ![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) [original image, 1.8M](https://24unix.net/build/images/Settings/user_screen_original.png)

View File

@@ -103,7 +103,7 @@ apply_dotfiles() {
link_dotfile "$DOTFILES_DIR/nvim" "$HOME/.config/nvim" link_dotfile "$DOTFILES_DIR/nvim" "$HOME/.config/nvim"
link_dotfile "$DOTFILES_DIR/tmux" "$HOME/.config/tmux" link_dotfile "$DOTFILES_DIR/tmux" "$HOME/.config/tmux"
if [ "$(uname -s)" = "Darwin" ]; then if [ "$(uname -s)" = "Darwin" ]; then
link_dotfile "$DOTFILES_DIR/karabiner" "$HOME/.config/karabiner" install_karabiner_config
fi fi
install_kitty_icon install_kitty_icon
install_tmux_plugins install_tmux_plugins
@@ -152,6 +152,12 @@ link_dotfile() {
echo "${GREEN}Linked $target_path -> $source_path${RESET}" 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() { install_kitty_icon() {
icon_path="$DOTFILES_DIR/kitty/kitty.app.png" icon_path="$DOTFILES_DIR/kitty/kitty.app.png"

View File

@@ -1,9 +1,75 @@
{ {
"profiles": [ "profiles": [
{ {
"name": "Default profile", "complex_modifications": {
"selected": true, "rules": [
"virtual_hid_keyboard": { "keyboard_type_v2": "ansi" } {
"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": {
"country_code": 0,
"keyboard_type_v2": "ansi"
}
} }
] ]
} }