Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kudryashov13 opened this issue Nov 26, 2021 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@kudryashov13
Copy link

kudryashov13 commented Nov 26, 2021

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

Screen.Recording.2021-11-26.at.09.37.06.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
@kudryashov13 kudryashov13 added the bug Something isn't working label Nov 26, 2021
@lwouis
Copy link
Owner

lwouis commented Nov 26, 2021

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

There is already a ticket for this actually, from a year ago: #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:

  • During the transition, AltTab needs to know which screen is the active screen (to honor Preferences > Appearance > Show on: [Active screen] ). Well what do you think the OS API returns when asked for the main screen during a Space transition when it's in the middle?
  • What if you hit the keyboard shortcut in the middle of the transition, and hold the tab key down? Holding tab triggers a key repeating behavior normally. But during a transition, AltTab UI is not visible, so we need to prevent it from moving to the next thumbnails one by one invisibly, so that when the UI finally shows, it's still on the first thumbnail, and then it starts to key repeat one by one.

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:

  • Single/Multi monitor
  • Single/Multi Space
  • System Preferences > Mission Control > Displays have separate Spaces

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 👍

@lwouis lwouis changed the title Apps from previous active desktop displayed [Show windows from Visible Spaces] Shows previous-Space windows when summoned during a Space transition Nov 26, 2021
@ADTC
Copy link

ADTC commented Apr 12, 2024

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.

@lwouis lwouis closed this as completed in 3c4aaf5 Nov 10, 2024
github-actions bot pushed a commit that referenced this issue Nov 10, 2024
# [7.3.0](v7.2.0...v7.3.0) (2024-11-10)

### Bug Fixes

* better handle screen or space changes (closes [#1254](#1254), closes [#2983](#2983)) ([3c4aaf5](3c4aaf5))
* potential issues with key repeats due to concurrency ([4cfe16a](4cfe16a))
* switcher would not close, or cycle on its own (closes [#3117](#3117)) ([d430f83](d430f83))
* works without screen-recording permissions (closes [#3819](#3819)) ([f7de2bb](f7de2bb))

### Features

* can pass the --logs= flags at launch to show logs ([81eb07e](81eb07e))
* improve el, fi, hi, it, pl, pt localizations ([a9614c1](a9614c1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants