Add karabiner, we now should be able to achieve sway parity on macos

with aerospace.
This commit is contained in:
Martin Larsson 2025-07-13 18:11:15 +02:00
parent c353fbe9a9
commit 49a2249634
4 changed files with 201 additions and 1 deletions

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
.DS_Store
home/.config/lazygit/state.yml
neomuttrc.local
karabiner/automatic_backups/
result

194
karabiner/karabiner.json Normal file
View file

@ -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" }
}
]
}

View file

@ -11,6 +11,10 @@ let
".config/aerospace"
"aerospace"
]
[
".config/karabiner"
"karabiner"
]
];
in
{

View file

@ -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;
};