koekeishiya / yabai

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

Stacked-mode window order changes after full-screen #2196

Open ashleyharvey opened 7 months ago

ashleyharvey commented 7 months ago

Running v.7.0.4.

If I put yabai into stacked mode, and then have 2 apps back-to-front, where app2 is front-most:

app1: window1 app2: window1 [front]

Now app2 creates a new window:

app1: window1 app2: window1, window2 [front]

Now app2 launches another app:

app1: window1 app2: window1, window2 app3: window1 [front]

When I quit app3 I would expect to go back to:

app1: window1 app2: window1, window2 [front]

However what happens is that I am returned to this, notice that app1 and app2 have swapped:

app2: window1, window2 app1: window1 [front]

And have to manually re-arrange the apps to get back to what I was doing.

Edit: I just realized something important. When app2 launches app3, app3 goes straight into full-screen. If I quit from full-screen, I get the behaviour mentioned above. However, if I exit full-screen mode in app3 first, and then quit app3, I get the expected behaviour, which is for app2 to be the next front-most app after app3 quits.

koekeishiya commented 7 months ago

Seems to work just fine for me. (did multiple attempts, also some with slight variations).

stack

  1. Open Console.app
  2. Open Terminal.app
  3. Spawn new Terminal.app window
  4. Use this app to spawn a new app that opens in native-fullscreen mode
  5. Quit new app while inside native-fullscreen mode.

In the recording I use a rule to make the app enter fullscreen right after spawning, but the same behavior happens if that window opens/restores "natively" in fullscreen without the yabai rule as well.

(When quitting the fullscreen app you can see that it focuses the first space, before putting me back on the correct space; this is a macOS thing and it will always happen regardless of whether yabai is running or not).

ashleyharvey commented 7 months ago

Seems to work just fine for me. (did multiple attempts, also some with slight variations).

  1. Open Console.app
  2. Open Terminal.app
  3. Spawn new Terminal.app window
  4. Use this app to spawn a new app that opens in native-fullscreen mode
  5. Quit new app while inside native-fullscreen mode.

In the recording I use a rule to make the app enter fullscreen right after spawning, but the same behavior happens if that window opens/restores "natively" in fullscreen without the yabai rule as well.

(When quitting the fullscreen app you can see that it focuses the first space, before putting me back on the correct space; this is a macOS thing and it will always happen regardless of whether yabai is running or not).

Here's an example of the behaviour. Notice how after quitting mpv it goes back to Finder instead of Hydrus. I'm wondering if mpv is doing some kind of non-native fullscreen and that's messing things up. Is there a way I can get more insight into what's happening with window/app ordering while it's happening?

https://github.com/koekeishiya/yabai/assets/3487945/6f4290a8-c1cd-4a3f-9ae9-60e535889228

ashleyharvey commented 7 months ago

Did some more investigation. If I instantiate mpv with --no-native-fullscreen, everything works as expected. It seems like it's native fullscreen that causes the issue. I think the difference between native and non-native fullscreen is that native fullscreen creates a new space to push the fullscreen window into, but I'm not sure.