koekeishiya / yabai

A tiling window manager for macOS based on binary space partitioning
MIT License
23.17k stars 641 forks source link

How can I set up window snapping to left, right, top, bottom of the screen? Like in Rectangle. ctrl+alt+(arrow) #2365

Open Pranav-Karra-3301 opened 1 month ago

Pranav-Karra-3301 commented 1 month ago

I asked chatgpt but it doesnt work.

xsova commented 3 weeks ago

@Pranav-Karra-3301 If you want to make it work explicitly like Rectangle, use this in your skhdrc file (I too wanted to replicate this functionality).

This possibly isn't entirely what you're looking for since I have it set to --toggle float, instead of setting it to float, but the grid works, I've tested it quite a bit (I use it as my daily driver).


  46   │ # Grid works like this: `1:4` = divide the screen into one row and four columns
  47   │ #                       `3:0` = starts at x = 3, y = 0 (in a zero based array of positions based on previous two numbers)
  48   │ #                       `1:1` = spans 1 column horizontally and vertically.
  49   │
  50   │ # Toggle floating, fill screen
  51   │ ctrl  + alt - return    : yabai -m window --toggle float --grid 1:1:0:0:1:1 # Full screen
  52   │ ctrl  + alt - left      : yabai -m window --toggle float --grid 1:2:0:0:1:1 # Left half
  53   │ ctrl  + alt - right     : yabai -m window --toggle float --grid 1:2:1:0:1:1 # Right half
  54   │ ctrl  + alt - up        : yabai -m window --toggle float --grid 2:1:0:0:1:1 # Top half
  55   │ ctrl  + alt - down      : yabai -m window --toggle float --grid 2:1:1:0:1:1 # Bottom half
  56   │
  57   │ # { Fourths }
  58   │ ctrl  + alt - h         : yabai -m window --toggle float --grid 1:4:0:0:1:1 # First fourth
  59   │ ctrl  + alt - t         : yabai -m window --toggle float --grid 1:4:1:0:1:1 # Second fourth
  60   │ ctrl  + alt - s         : yabai -m window --toggle float --grid 1:4:2:0:1:1 # Third fourth
  61   │ ctrl  + alt - n         : yabai -m window --toggle float --grid 1:4:3:0:1:1 # Fourth fourth
  62   │ ctrl  + alt - l         : yabai -m window --toggle float --grid 1:4:0:0:3:1 # First through third fourths
  63   │ ctrl  + alt - v         : yabai -m window --toggle float --grid 1:4:1:0:3:1 # Second through last fourths
  64   │
  65   │ # { Thirds }
  66   │ ctrl  + alt - i         : yabai -m window --toggle float --grid 1:3:0:0:1:1 # Left third
  67   │ ctrl  + alt - e         : yabai -m window --toggle float --grid 1:3:1:0:1:1 # Middle third
  68   │ ctrl  + alt - a         : yabai -m window --toggle float --grid 1:3:2:0:1:1 # Right third
  69   │ ctrl  + alt - y         : yabai -m window --toggle float --grid 1:3:0:0:2:1 # Left 2/3
  70   │ ctrl  + alt - u         : yabai -m window --toggle float --grid 1:3:1:0:2:1 # Right 2/3
xsova commented 3 weeks ago

Also worth noting, I don't use QWERTY layout, so ymmv (if you want a rough ergo translation, check out engram