lwouis / alt-tab-macos

Windows alt-tab on macOS
https://alt-tab-macos.netlify.app
GNU General Public License v3.0
10.59k stars 322 forks source link

Shows previous-Space windows when summoned during a Space transition #1254

Open kudryashov13 opened 2 years ago

kudryashov13 commented 2 years ago

Hello, thank you for this app, it's amazing!

I faced with some strange behaviour when using multiple desktops and 'Show windows from Visible Spaces' option at the same time.

I recorded a short video, to show this behavior

https://user-images.githubusercontent.com/57399846/143532276-9ebcf9fb-45b6-477e-88af-f60f2616f178.mov

As you can see on the video I stared from desktop with 2 Google Chrome windows opened, and 1 Mail App window. Then I switched to the next desktop with VS Code and Spotify window apps. I opened AltTab and it show all windows from previous desktop plus VS Code window. Then I closed and opened AltTab again, now it show correct app windows from current active desktop. I understand that switch desktop and quickly run AltTab not othen use case but it would be nice if there is some solution for this kind of problem for me. I searched through existing Issues but didn't found any where this problem was described.

Steps to reproduce: 1) Create 2 desktops 2) Place different app windows on them 3) Switch between desktops 4) After switching try open Alt-Tab as fast as possible ER: Shows only apps from current active desktop AR: Shows apps from previous desktop + current desktop apps

My machine About This Mac
AltTab version AltTab version
AltTab settings Screenshot 2021-11-26 at 09 44 30 Screenshot 2021-11-26 at 09 44 17
lwouis commented 2 years ago

Hi @kudryashov13 and thanks for this high-quality bug report!

There is already a ticket for this actually, from a year ago: https://github.com/lwouis/alt-tab-macos/issues/689

That being said, your ticket has much better material to explain the issue. The other was a quick ticket I opened to revisit later, but never ended up having time to do. So I'll close it, and let's use yours.

I checked the git logs, and you can see this is not the first time there are edge-cases around this:

image

Just a few examples I'll share so that you know the joy it is to deal with this:

I remember that at some point I changed the implementation on how the AltTab window deals with Space transitions. Spaces are really not properly handled by macOS. There is almost no exposed API to deal with them. Here we want the window to be shown on the new Space as soon as the animation is over.

For instance, here are some APIs that I think influence how the OS deals with the windows during Space transitions. Their documentation doesn't cover the effects properly of course (macOS docs are a joke), but in my tests I found influences when tweaking those:

Another thing is that macOS has quirks/bugs in more exotic setups like combinations of:

There are specific issues for instance when switching to another Space on another monitor, or the same thing but the Space on the other monitor was not the current Space on that monitor, so it does a double transition.

As a result it's very hard to QA all setups/scenarios, and avoid regressing in one when fixing the other. I documented some tricky ones I worked on in the past here. It's a lot of work to be honest.

To summarize, your issue is valid, and we need to tweak the implementation to do better (if that's actually possible), and QA it in all the exotic use-cases/setups 👍

ADTC commented 5 months ago

Hey @lwouis do you think we can fix this? For me:

Switching between spaces and immediately launching AltTab (limited to current space) gets confusing results. Sometimes it shows only previous space, sometimes a mix of both spaces, sometimes it shows one set of windows which quickly expands to a bigger set of windows. It seems like I have to wait a second or two after switching space for AltTab to catch up before opening it, which slows me down.