koekeishiya / yabai

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

Repeat zoom parent #1483

Open nocksock opened 2 years ago

nocksock commented 2 years ago

It would be neat to be able to repeat the zoom parent action, so that the window would zoom up the tree. Sometimes zoom-parent is not enough and fullscreen is too much for me.

Assuming window D has focus:

$ yabai -m window --zoom up
 ┌─────────────────┬─────────────────┬─────────────────┐
 │                 │                 │                 │
 │                 │                 │                 │
 │                 │                 │        C        │
 │                 │                 │                 │
 │        A        │         B       ├─────────────────┤
 │                 │                 │                 │
 │                 │                 │                 │
 │                 │                 │        D        │
 │                 │                 │                 │
 └─────────────────┴─────────────────┴─────────────────┘

$ yabai -m window --zoom up
 ┌─────────────────┬─────────────────┬─────────────────┐
 │                 │                 │                 │
 │                 │                 │                 │
 │                 │                 │                 │
 │        A        │         B       │        D        │
 │                 │                 │                 │
 │                 │                 │                 │
 │                 │                 │                 │
 └─────────────────┴─────────────────┴─────────────────┘

$ yabai -m window --zoom up
 ┌─────────────────┬───────────────────────────────────┐
 │                 │                                   │
 │                 │                                   │
 │                 │                                   │
 │        A        │                 D                 │
 │                 │                                   │
 │                 │                                   │
 │                 │                                   │
 └─────────────────┴───────────────────────────────────┘

$ yabai -m window --zoom down
 ┌─────────────────┬─────────────────┬─────────────────┐
 │                 │                 │                 │
 │                 │                 │                 │
 │                 │                 │                 │
 │        A        │         B       │        D        │
 │                 │                 │                 │
 │                 │                 │                 │
 │                 │                 │                 │
 └─────────────────┴─────────────────┴─────────────────┘

Right now I have a binding that makes the window floating and resize to a predetermined grid, but this makes things "reflow" and isn't as flexible for different layouts; so I end up with different mappings. This would let me only have to remember two mappings for zooming up and down.

Here's a suggested API:

yabai -m window --zoom up // zoom up one parent
yabai -m window --zoom down // zoom down again
yabai -m window --zoom reset // reset
yabai -m window --zoom abs:0 // reset 
yabai -m window --zoom abs:2 // take up two parents
yabai -m window --zoom rel:2 // zoom up two parents

I guess this could be built right now with a bash script by querying windows etc, and I might do that when I find the time to do so, but I thought I shared this idea.

natsumi commented 1 year ago

A feature like would be killer for people on ultra wide monitors. @nocksock did you ever create a bash script to help facilitate this? If so, can you share?

nocksock commented 1 year ago

@natsumi unfortunately not. I'm currently turning that window D from the example to a floating window and back, which works "good enough" for my use cases to not have written that script. However I still wish this existed.