Yabai

Hierarchy

  1. display has one or more
  2. spaces. these contain
  3. windows

If the layout is set to bsp, the space is treated like a tree.

Commands

  • swap: change position of two windows
  • warp: a window becomes the main tree node

Pass commands to yabai: yabai -m <command>.

Set window ratio: yabai -m window --ratio abs:0.2

Get id for a window

yabai -m query --windows | jq '.[] | select(.app == "kitty").id'

Get first window on second monitor

yabai -m query --spaces | jq '.[] | select(.index == 2)["first-window"]'

Resizing tiled window

From MacOS - Yabai Configuration

# increase window size
yabai -m window --resize left:-20:0
yabai -m window --resize bottom:0:20
yabai -m window --resize top:0:-20
yabai -m window --resize right:20:0
 
# decrease window size
yabai -m window --resize left:20:0
yabai -m window --resize bottom:0:-20
yabai -m window --resize top:0:20
yabai -m window --resize right:-20:0

Keyboard shortcuts

  • ◊+S: a leader key that enters the movement modal…
    • 1: takes the focused window and puts it in the “main” location of the screen
    • 2/3/4: sets the ratio of splits to 1/x, eg. 1/3 for 3
    • V: mirror space vertically
    • X: swap vertical/horizontal split
    • M: maximise focused window
    • H/J/K/L: move focus to window using vim-directions
    • alt-H/J/K/L: warp focused window using vim-directions
    • ctrl-H/J/K/L: swap focused window using vim-directions
    • shift-H/L: move focused window to monitor
    • E: balance windows
    • B/shift-B: toggle bsp/stack layout