koekeishiya / yabai

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

Ability to un-maximize window on it losing focus? #934

Closed erikc96 closed 2 years ago

erikc96 commented 3 years ago

Basically, I'm on a smaller display so using apps in fullscreen is really helpful.

But having my apps open in a grid really helps keep track of everything.

It'll be easier to stick to a good layout if I can have switching to another window unmaximize my current one, because otherwise things start to really look jumbled if I don't manually unmaximize the one.

Does anyone know if this is possible?

koekeishiya commented 3 years ago

Write a signal that listens to window_focused and query the recent window (yabai -m query --windows --window recent) and do yabai -m window recent --toggle zoom-fullscreen if the zoom-fullscreen property is set.

gardamork commented 3 years ago

Based on the previous comment and my non-existing shell scripting capabilities, I put something together which seems to do the trick:

yabai -m signal --add event=window_focused action="if (yabai -m query --windows --window recent | jq '.\"zoom-fullscreen\"' | grep '1' > /dev/null); then yabai -m window recent --toggle zoom-fullscreen; fi;"

mizlan commented 8 months ago

Since the field has changed, and I also have the slightest more shell scripting capability, here's the version I use:

yabai -m signal --add event=window_focused action="yabai -m query --windows --window recent | jq -e '.\"has-fullscreen-zoom\"' && yabai -m window recent --toggle zoom-fullscreen"