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

Thunderbird and Skim window now showing up in list of windows in AltTab #772

Closed
AgilentGCMS opened this issue Jan 12, 2021 · 15 comments
Closed
Labels
bug Something isn't working need breakthrough Need a breakthrough idea to move forwards

Comments

@AgilentGCMS
Copy link

Describe the bug

I have three windows from three different apps open on my current workspace, geany (a code editor), iTerm2 (terminal), and thunderbird (email client). I have AltTab set up to display all apps from visible spaces upon Cmd+Tab. However, when I hit Cmd+Tab, thunderbird does not show in the thumbnails. I've taken a screenshot right after hitting Cmd+Tab and before releasing Cmd. You can see all three windows, i.e., none of them are hidden or minimized, yet the AltTab thumbnails on top only contain two.

Steps to reproduce the bug

  1. Open several apps, including Thunderbird.
  2. Hit Cmd+Tab to switch between them.

Note: This is not 100% reproducible. Sometimes AltTab does show a thumbnail for thunderbird. However, once it starts to not show the thunderbird thumbnail, the only fix is to quit and restart thunderbird. I have not checked if this bug exists for other apps, I'm reporting for thunderbird because that's where I first noticed it.

@AgilentGCMS AgilentGCMS added the bug Something isn't working label Jan 12, 2021
@mfn
Copy link

mfn commented Jan 13, 2021

This is not 100% reproducible

I can confirm that I've seen this behavour in recent times too, but it's not clearly reproducible (and happened really rarely to me).

@lwouis
Copy link
Owner

lwouis commented Jan 13, 2021

I downloaded Thunderbird, but it always shows in AltTab in my tests.

Could you please find steps that reproduce the issue more frequently? I can't reproduce the issue unfortunately

Potential duplicate of #639

@lwouis lwouis added the unreproducible Need help from the author to reproduce the issue label Jan 13, 2021
@AgilentGCMS
Copy link
Author

It might well be a duplicate of #639. I have not found a way to reproduce this behavior reliably, it remains stubbornly intermittent. When I submitted this bug, the thunderbird window was in the workspace where it was opened (I use multiple workspaces), I was not connected to an external monitor, and no window was fullscreen.

I understand it's hard to debug an issue you can't reproduce. The next time this happens, I will try to trace back what I was doing in or to the missing window before. Since this is not reproducible, is there something I/we can do to help debug once this behavior starts?

@AgilentGCMS
Copy link
Author

Just saw this behavior for a different app, Skim, the PDF reader. This time the behavior is repeatable, and here's how:

  1. I started with two apps open on my workspace, Thunderbird with two windows, and Skim with one document open in one window. At this point, AltTab shows me three thumbnails, as expected.
  2. In Skim, I opened another document, which opens in a new window. This new window is now on top of all other windows.
  3. However, at this point AltTab does not show the new Skim window. It still shows the two thunderbird windows and the earlier Skim window.
  4. If I now select another window, and then click on the new Skim window to bring it back to the foreground, this causes AltTab to learn about the new Skim window. From this point on, AltTab shows four windows, as expected.
  5. I can close the new Skim window, then repeat step 2, which reproduces steps 3 and 4 every time.

@lwouis
Copy link
Owner

lwouis commented Jan 14, 2021

@AgilentGCMS I installed Skim, and tried to reproduce, but it's not happening for me.

@lwouis lwouis added the duplicate This issue or pull request already exists label Jan 14, 2021
@AgilentGCMS
Copy link
Author

AgilentGCMS commented Jan 15, 2021

@lwouis I just tried doing what you did, i.e., open both files from Finder > Open with > Skim, and indeed AltTab shows both windows. However, can you do the following instead:

  1. After opening the first file, close the finder window.
  2. Open the second file file by hitting Cmd+O in Skim, then selecting the second file from the file selector that pops up.
  3. Immediate hit Cmd+Tab to see if both Skim windows show up.

On my computer, I'm noticing that this way reproduces the problem, while opening both from Finder does not.

@AgilentGCMS
Copy link
Author

@lwouis Could you reproduce the behavior?

@lwouis
Copy link
Owner

lwouis commented Jan 20, 2021

@AgilentGCMS I was able to reproduce! That's great! I'll investigate further now on what's happening. Here are the repro steps:

  • Open a PDF with Skim
  • Cmd+o > select another PDF
  • The second PDF window opens, but is not listed in AltTab

@lwouis lwouis removed the unreproducible Need help from the author to reproduce the issue label Jan 20, 2021
@lwouis
Copy link
Owner

lwouis commented Jan 20, 2021

The issue seems to be detecting that the window is on the normal level:

image

It seems that the window is initially not on the normal level, right when it spawns, probably due to some macOS animation that's slightly different when opening it from the Open file... menu compared to double clicking in the Finder. Quickly after, the boolean flips from false to true.

The reason we look at "is the window on the normal level" is encapsulated in this comment: helps filter out iStats Pro and other top-level pop-overs, and floating windows.

We need to change the heuristic to handle this better. Either observing changes of that value, as we do for other things like this that change in the first milliseconds of an app launching, or a window opening. Alternatively, we could use a different clever heuristic to help filter out the floating windows.

This issue was found, amplified, in Books.app. A potential fix here could also fix #627.

@lwouis lwouis added need breakthrough Need a breakthrough idea to move forwards and removed duplicate This issue or pull request already exists labels Jan 24, 2021
@lwouis
Copy link
Owner

lwouis commented Jan 25, 2021

Possible duplicate of #639

@lwouis lwouis changed the title Thunderbird window now showing up in list of windows in AltTab Thunderbird and Skim window now showing up in list of windows in AltTab Jan 25, 2021
@lwouis
Copy link
Owner

lwouis commented Jan 25, 2021

I've spend some time trying to find a good heuristic. I can't find anything that could be a proxy to "this window is floating on top of other windows". Especially since it may actually not be true for a few frames during the window creation. The OS is giving us an "incorrect" level for the window for a very short time, before we would get the actual level, but this may reflect an animation or OS glitch where windows spawn at a different level than they end up at.

I could see adding a delay before reading the level, but that has obvious downsides. Best would be to observe, but it's a private API, so no way to do that. We could retry on a quick loop (few ms) for a few hundred ms. It has also obvious downsides.

@AgilentGCMS
Copy link
Author

I should say that while the thunderbird issue is not as easily reproducible, when it does occur it's fairly stubborn in staying. E.g., right now I have Brave browser and thunderbird open (two windows), and even though Thunderbird is in the foreground and above Brave, AltTab is not showing Thunderbird. I can even minimize Brave at this point, and AltTab will still not show Thunderbird. The only fix I've found is to quit and then restart AltTab, then the thunderbird windows show up.

@lwouis
Copy link
Owner

lwouis commented Feb 7, 2021

I can't reproduce the issue with Thunderbird, and same goes for other reports in #639.

The only thing i could reproduce and thus investigate is with Skim. It may be that every other case is stemming from the same root cause: window level (windows being on top of others) changing right when a window is created. It would explain why AltTab recognizes missing windows after a restart, as these would then be stable with the correct level.

it could also be that these other scenarios have other root causes. No way to know until i can reproduce and investigate them.

For now, the only thing i could investigate is tricky. I've written above how i don't have a way right now to avoid the issue. That's why i tagged this ticket with the "need breakthrough" label which i use when i'm hoping someone could step in and help with a clever idea or even better share code directly.

@lwouis lwouis closed this as completed in fed2eb6 Feb 16, 2021
lwouis pushed a commit that referenced this issue Feb 16, 2021
## [6.15.1](v6.15.0...v6.15.1) (2021-02-16)

### Bug Fixes

* didn't show skim app windows (closes [#772](#772)) ([fed2eb6](fed2eb6))
* issues with the app mediathekview (closes [#822](#822)) ([0181547](0181547))
* live2d cubism editor stuck on startup (closes [#813](#813)) ([ee5c44f](ee5c44f))
@lwouis
Copy link
Owner

lwouis commented Mar 8, 2021

@AgilentGCMS @mfn This ticket was closed automatically when I tagged it in some commits. I'd like to clarify the status to you: the bug in Skim should be fixed. I can no longer reproduce it locally.

Could you please let me know if it's fixed for you as well? Regarding Thunderbird, please also let me know. I couldn't reproduce the issue previously, so I rely on you to tell me if the issue is indeed gone or not 👍

@mfn
Copy link

mfn commented Mar 11, 2021

Thanks for the ping, don't recall having seen this recently 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need breakthrough Need a breakthrough idea to move forwards
Projects
None yet
Development

No branches or pull requests

3 participants