Skip to content

Commit

Permalink
feat: allow cycling forward & backward!! πŸš€πŸš€πŸš€
Browse files Browse the repository at this point in the history
bliss

koekeishiya/yabai#203 (comment)

Signed-off-by: Kipras Melnikovas <kipras@kipras.org>
  • Loading branch information
kiprasmel committed Oct 6, 2021
1 parent 64070c7 commit 7e7f5ca
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scripts/backward-cycle-yabai
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env sh

# https://github.com/koekeishiya/yabai/issues/203#issuecomment-700527407

# backward
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 {}

11 changes: 11 additions & 0 deletions scripts/forward-cycle-yabai
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env sh

# https://github.com/koekeishiya/yabai/issues/203#issuecomment-700527407

# forward
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 {}

6 changes: 6 additions & 0 deletions skhdrc
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,9 @@ shift + lctrl + alt - r : \
# Make window native fullscreen
alt - f : yabai -m window --toggle zoom-fullscreen
shift + alt - f : yabai -m window --toggle native-fullscreen

# a single keybind for cycling!
# https://github.com/koekeishiya/yabai/issues/203#issuecomment-700527407
lalt - escape : "${HOME}"/.config/yabai/scripts/forward-cycle-yabai
ralt - escape : "${HOME}"/.config/yabai/scripts/backward-cycle-yabai

0 comments on commit 7e7f5ca

Please sign in to comment.