koekeishiya / yabai

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

Treat windows in Stage Manager as minimized windows #1580

Open dominiklohmann opened 1 year ago

dominiklohmann commented 1 year ago

I've been playing with stage manager a bit lately as an alternative to hiding windows, which works surprisingly well for me. This does not currently work well with yabai, though—windows hidden in Stage Manager are still recognized by yabai, messing up the tiling.

The expected behavior to me would be that yabai treats windows hidden this way just like other minimized windows. Looking at windows in Stage Manager using Accessibility Inspector, there is nothing immediately obvious that signals whether a window is in this state, so I'm not sure how that would be detected.

Edit: I s/hidden/minimized as I've noticed that pressing cmd + m with Stage Manager enabled actually hides the window from the current stage rather than minimizing it, so it would only be natural to treat these windows as minimized instead.

Muzosh commented 1 year ago

Any updates? There is very very similar old issue in Amethyst.

Muzosh commented 1 year ago

I'm not really an Apple Developer expert, but it seems that there is no way of getting Stage Manager related information to the AppKit. Maybe my testing was wrong, but it seems that simple check for whether the window is minimized doesn't work (i.e. cmd+m hides it in the stage manager, but its state is not minimized).

koekeishiya commented 1 year ago

I have not really looked at how Stage Manager works and behaves at all, to be honest. Solving these "issues" "from scratch" often require a lot of time investment, and I am not particularly interested in spending that amount of time.

Back in the day I probably would have, but I no longer find the same enjoyment (both in terms of fun and the reward in solving the problem) anymore from doing this.

That said, my first instinct would be to look at whether the windows managed by Stage Manager have certain tags set. These can be retrieved using this function in yabai: https://github.com/koekeishiya/yabai/blob/master/src/window.c#L347

It used to be a part of the window query output that yabai exposes to the user through its CLI, but was removed because it caused crashes under certain circumstances (when a query would try to access the information about a disposed window, #1475). I would first look at that value of those bits and compare between windows in and outside Stage Manager.