Skip to content

Instantly share code, notes, and snippets.

@sulami
Created May 13, 2020 12:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sulami/e867db25214fe6a00f6d981063b41cbb to your computer and use it in GitHub Desktop.
Save sulami/e867db25214fe6a00f6d981063b41cbb to your computer and use it in GitHub Desktop.
Yabai config for vertical stacks
# -*- mode: sh -*-
# This implements automatic vertical stacking of windows in Yabai, like so:
# +------+ +---+--+ +---+--+
# | | | | | | | |
# | | => | | | => | +--+
# | | | | | | | |
# +------+ +---+--+ +---+--+
yabai -m config auto_balance off
yabai -m config split_ratio 0.6
yabai -m signal --add \
label=new-window-tile \
event=window_created \
action='yabai -m window $YABAI_WINDOW_ID --warp last; \
if [[ `yabai -m query --windows --space | jq -r "length"` = 2 ]] && [[ `yabai -m query --windows --window $YABAI_WINDOW_ID | jq -r ".split"` = "horizontal" ]]; then \
yabai -m window --toggle split; \
elif [[ `yabai -m query --windows --space | jq -r "length"` != 2 ]] && [[ `yabai -m query --windows --window $YABAI_WINDOW_ID | jq -r ".split"` = "vertical" ]]; then \
yabai -m window --toggle split; \
fi;'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment