From 98b6fd715f6966f8e22c7bb5ba1806de7d8361a2 Mon Sep 17 00:00:00 2001 From: Michael Thomas Date: Tue, 27 Feb 2024 12:18:34 -0500 Subject: [PATCH] feat(yabai): add keyboard shortcuts --- modules/yabai.nix | 51 +++++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/modules/yabai.nix b/modules/yabai.nix index bc4b6d2..c19a320 100644 --- a/modules/yabai.nix +++ b/modules/yabai.nix @@ -34,25 +34,42 @@ services.skhd = { enable = true; skhdConfig = '' - alt - h: yabai -m window --focus west - alt - j: yabai -m window --focus south - alt - k: yabai -m window --focus north - alt - l: yabai -m window --focus east + ctrl + alt - h: yabai -m window --focus west + ctrl + alt - j: yabai -m window --focus south + ctrl + alt - k: yabai -m window --focus north + ctrl + alt - l: yabai -m window --focus east - shift + alt - h : yabai -m window --warp east - shift + alt - j : yabai -m window --warp north - shift + alt - k : yabai -m window --warp south - shift + alt - l : yabai -m window --warp west + cmd + ctrl + alt - h : yabai -m window --warp west + cmd + ctrl + alt - j : yabai -m window --warp south + cmd + ctrl + alt - k : yabai -m window --warp north + cmd + ctrl + alt - l : yabai -m window --warp east + + ctrl + alt - 1 : yabai -m space --focus 1 + ctrl + alt - 2 : yabai -m space --focus 2 + ctrl + alt - 3 : yabai -m space --focus 3 + ctrl + alt - 4 : yabai -m space --focus 4 + ctrl + alt - 5 : yabai -m space --focus 5 + ctrl + alt - 6 : yabai -m space --focus 6 + ctrl + alt - 7 : yabai -m space --focus 7 + ctrl + alt - 8 : yabai -m space --focus 8 + ctrl + alt - 9 : yabai -m space --focus 9 + + ctrl + alt - q: yabai -m window --close + + # 0x21 - [ + # 0x1E - ] + ctrl + alt - 0x21 : yabai -m query --spaces --space \ + | jq -re ".index" \ + | xargs -I{} yabai -m query --windows --space {} \ + | jq -sre "add | map(select(.minimized != 1)) | sort_by(.display, .frame.y, .frame.y, .id) | nth(index(map(select(.focused == 1))) - 1).id" \ + | xargs -I{} yabai -m window --focus {} + + ctrl + alt - 0x1E : yabai -m query --spaces --space \ + | jq -re ".index" \ + | xargs -I{} yabai -m query --windows --space {} \ + | jq -sre "add | map(select(.minimized != 1)) | sort_by(.display, .frame.y, .frame.x, .id) | reverse | nth(index(map(select(.focused == 1))) - 1).id" \ + | xargs -I{} yabai -m window --focus {} - cmd + alt - 1 : yabai -m space --focus 1 - cmd + alt - 2 : yabai -m space --focus 2 - cmd + alt - 3 : yabai -m space --focus 3 - cmd + alt - 4 : yabai -m space --focus 4 - cmd + alt - 5 : yabai -m space --focus 5 - cmd + alt - 6 : yabai -m space --focus 6 - cmd + alt - 7 : yabai -m space --focus 7 - cmd + alt - 8 : yabai -m space --focus 8 - cmd + alt - 9 : yabai -m space --focus 9 ''; }; }