Files
bankrupt/darwin/skhd.nix
T
tomatocream d0047a1c7b misc tweaks: skhd bnpf bindings, neovim/doom/fish fixes
- skhd: remap window nav/move/resize/stack from hjkl to Emacs-style bnpf;
  remap fullscreen/zoom to m, borders to o, prev/next space to [/];
  add super-z to open emacsclient
- neovim: fix catppuccin integration key (neo_tree -> neotree) so init
  loads without the "module not found" traceback
- doom: disable lispy/objed/parinfer modules
- fish: add ~/.bun/bin to PATH

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 19:17:22 +08:00

118 lines
6.5 KiB
Nix

# skhd (Simple Hotkey Daemon) configuration for macOS
# Uses nix-darwin's services.skhd module
#
# Directional keys use Emacs-style BPNF:
# b = west (backward), n = south (next), p = north (previous), f = east (forward)
{
config,
lib,
pkgs,
...
}: let
super = "lalt";
in {
services.skhd = {
enable = true;
skhdConfig = ''
## Navigation (${super} - ...)
# Space Navigation: ${super} - {1-9, 0}
${super} - 1 : yabai -m space --focus 1
${super} - 2 : yabai -m space --focus 2
${super} - 3 : yabai -m space --focus 3
${super} - 4 : yabai -m space --focus 4
${super} - 5 : yabai -m space --focus 5
${super} - 6 : yabai -m space --focus 6
${super} - 7 : yabai -m space --focus 7
${super} - 8 : yabai -m space --focus 8
${super} - 9 : yabai -m space --focus 9
${super} - 0 : yabai -m space --focus 0
# Window Navigation (through display borders): ${super} - {b, n, p, f}
${super} - b : yabai -m window --focus west || yabai -m display --focus west
${super} - n : yabai -m window --focus south || yabai -m display --focus south
${super} - p : yabai -m window --focus north || yabai -m display --focus north
${super} - f : yabai -m window --focus east || yabai -m display --focus east
# Float / Unfloat window: ${super} - space
# ${super} - space : yabai -m window --toggle float; sketchybar --trigger window_focus
# Make window zoom to fullscreen: shift + ${super} - m
shift + ${super} - m : yabai -m window --toggle zoom-fullscreen; sketchybar --trigger window_focus
# Make window zoom to parent node: ${super} - m
${super} - m : yabai -m window --toggle zoom-parent; sketchybar --trigger window_focus
## Window Movement (shift + ${super} - ...)
# Swap/warp windows directionally: shift + ${super} - {b, n, p, f}
shift + ${super} - b : yabai -m window --swap west || $(yabai -m window --display west && sketchybar --trigger windows_on_spaces && yabai -m display --focus west && yabai -m window --warp last) || yabai -m window --move rel:-10:0
shift + ${super} - n : yabai -m window --swap south || $(yabai -m window --display south && sketchybar --trigger windows_on_spaces && yabai -m display --focus south) || yabai -m window --move rel:0:10
shift + ${super} - p : yabai -m window --swap north || $(yabai -m window --display north && sketchybar --trigger windows_on_spaces && yabai -m display --focus north) || yabai -m window --move rel:0:-10
shift + ${super} - f : yabai -m window --swap east || $(yabai -m window --display east && sketchybar --trigger windows_on_spaces && yabai -m display --focus east && yabai -m window --warp first) || yabai -m window --move rel:10:0
# Toggle split orientation of the selected windows node: shift + ${super} - s
shift + ${super} - s : yabai -m window --toggle split
# Moving windows between spaces: shift + ${super} - {1, 2, 3, 4, [, ] }
shift + ${super} - 1 : DISPLAY="$(yabai -m query --displays --display | jq '.index')";\
yabai -m window --space $((1+4*($DISPLAY - 1)));\
sketchybar --trigger windows_on_spaces
shift + ${super} - 2 : DISPLAY="$(yabai -m query --displays --display | jq '.index')";\
yabai -m window --space $((2+4*($DISPLAY - 1)));\
sketchybar --trigger windows_on_spaces
shift + ${super} - 3 : DISPLAY="$(yabai -m query --displays --display | jq '.index')";\
yabai -m window --space $((3+4*($DISPLAY - 1)));\
sketchybar --trigger windows_on_spaces
shift + ${super} - 4 : DISPLAY="$(yabai -m query --displays --display | jq '.index')";\
yabai -m window --space $((4+4*($DISPLAY - 1)));\
sketchybar --trigger windows_on_spaces
shift + ${super} - 0x21 : yabai -m window --space prev; yabai -m space --focus prev; sketchybar --trigger windows_on_spaces
shift + ${super} - 0x1E : yabai -m window --space next; yabai -m space --focus next; sketchybar --trigger windows_on_spaces
# Mirror Space on X and Y Axis: shift + ${super} - {x, y}
shift + ${super} - x : yabai -m space --mirror x-axis
shift + ${super} - y : yabai -m space --mirror y-axis
## Stacks (shift + ctrl - ...)
# Add the active window to the window or stack to the {direction}: shift + ctrl - {b, n, p, f}
shift + ctrl - b : yabai -m window west --stack $(yabai -m query --windows --window | jq -r '.id'); sketchybar --trigger window_focus
shift + ctrl - n : yabai -m window south --stack $(yabai -m query --windows --window | jq -r '.id'); sketchybar --trigger window_focus
shift + ctrl - p : yabai -m window north --stack $(yabai -m query --windows --window | jq -r '.id'); sketchybar --trigger window_focus
shift + ctrl - f : yabai -m window east --stack $(yabai -m query --windows --window | jq -r '.id'); sketchybar --trigger window_focus
# Stack Navigation: shift + ctrl - {], [}
shift + ctrl - 0x1E : yabai -m window --focus stack.next
shift + ctrl - 0x21 : yabai -m window --focus stack.prev
## Resize (ctrl + ${super} - ...)
# Resize windows: ctrl + ${super} - {b, n, p, f}
ctrl + ${super} - b : yabai -m window --resize right:-100:0 || yabai -m window --resize left:-100:0
ctrl + ${super} - n : yabai -m window --resize bottom:0:100 || yabai -m window --resize top:0:100
ctrl + ${super} - p : yabai -m window --resize bottom:0:-100 || yabai -m window --resize top:0:-100
ctrl + ${super} - f : yabai -m window --resize right:100:0 || yabai -m window --resize left:100:0
# Equalize size of windows: ctrl + ${super} - e
ctrl + ${super} - e : yabai -m space --balance
# Enable / Disable gaps in current workspace: ctrl + ${super} - g
ctrl + ${super} - g : yabai -m space --toggle padding; yabai -m space --toggle gap
# Enable / Disable window borders in current workspace: ctrl + ${super} - o
ctrl + ${super} - o : yabai -m config window_border off
shift + ctrl + ${super} - o : yabai -m config window_border on
## Misc
# Open new Kitty window
${super} - return : kitty --single-instance -d ~
# Bring Kitty window to current space
${super} - o : yabai -m window $(yabai -m query --windows | jq '.[] | select(.app==".kitty-wrapped") | .id') --space $(yabai -m query --spaces | jq '.[] | select(.has-focus==1) .id')
# Open Emacs client
${super} - z : emacsclient -nc
'';
};
}