From 5bb1e4df7f125cadc79a1a962d44fc72b8a8310e Mon Sep 17 00:00:00 2001 From: Wong Ding Feng Date: Fri, 16 Jan 2026 01:02:31 +0800 Subject: [PATCH] aoeu --- darwin/skhd.nix | 111 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 darwin/skhd.nix diff --git a/darwin/skhd.nix b/darwin/skhd.nix new file mode 100644 index 0000000..dae5e41 --- /dev/null +++ b/darwin/skhd.nix @@ -0,0 +1,111 @@ +# Simple Hotkey Daemon configuration for nix-darwin +{ + config, + lib, + pkgs, + ... +}: let + super = "lalt"; +in { + services.skhd = { + enable = true; + package = pkgs.skhd; + skhdConfig = '' + ## Navigation (${super} - ...) + # Space Navigation (four spaces per display): ${super} - {1, 2, 3, 4} + ${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} - {h, j, k, l} + ${super} - h : yabai -m window --focus west || yabai -m display --focus west + ${super} - j : yabai -m window --focus south || yabai -m display --focus south + ${super} - k : yabai -m window --focus north || yabai -m display --focus north + ${super} - l : 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} - f + shift + ${super} - f : yabai -m window --toggle zoom-fullscreen; sketchybar --trigger window_focus + + # Make window zoom to parent node: ${super} - f + ${super} - f : yabai -m window --toggle zoom-parent; sketchybar --trigger window_focus + + ## Window Movement (shift + ${super} - ...) + # Moving windows in spaces: shift + ${super} - {h, j, k, l} + shift + ${super} - h : yabai -m window --warp 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} - j : yabai -m window --warp 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} - k : yabai -m window --warp 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} - l : yabai -m window --warp 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, p, n } (Assumes 4 Spaces Max per Display) + 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} - p : yabai -m window --space prev; yabai -m space --focus prev; sketchybar --trigger windows_on_spaces + shift + ${super} - n : 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 - {h, j, k, l} + shift + ctrl - h : yabai -m window west --stack $(yabai -m query --windows --window | jq -r '.id'); sketchybar --trigger window_focus + shift + ctrl - j : yabai -m window south --stack $(yabai -m query --windows --window | jq -r '.id'); sketchybar --trigger window_focus + shift + ctrl - k : yabai -m window north --stack $(yabai -m query --windows --window | jq -r '.id'); sketchybar --trigger window_focus + shift + ctrl - l : yabai -m window east --stack $(yabai -m query --windows --window | jq -r '.id'); sketchybar --trigger window_focus + + # Stack Navigation: shift + ctrl - {n, p} + shift + ctrl - n : yabai -m window --focus stack.next + shift + ctrl - p : yabai -m window --focus stack.prev + + ## Resize (ctrl + ${super} - ...) + # Resize windows: ctrl + ${super} - {h, j, k, l} + ctrl + ${super} - h : yabai -m window --resize right:-100:0 || yabai -m window --resize left:-100:0 + ctrl + ${super} - j : yabai -m window --resize bottom:0:100 || yabai -m window --resize top:0:100 + ctrl + ${super} - k : yabai -m window --resize bottom:0:-100 || yabai -m window --resize top:0:-100 + ctrl + ${super} - l : 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} - b + ctrl + ${super} - b : yabai -m config window_border off + shift + ctrl + ${super} - b : yabai -m config window_border on + + ## Misc + # Open new Kitty window + ${super} - return : kitty + # 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') + ''; + }; +}