-
-
Notifications
You must be signed in to change notification settings - Fork 346
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
AltTab sometimes doesn't detect windows when they are opened already in fullscreen #1002
Comments
Duplicate of #647 and others |
Hi, I don't think this is a duplicate. |
Oh, I understand. I'm sorry but that workaround doesn't seem worth it to me. It would probably be hard, even maybe impossible to implement. There is information that is lost if it's missed, like the event of a window being spawned. When AltTab is restarted, it will probably find all windows, but then it loses the recently-used order. After launch, windows order is their z-index, not their recently-used order. The satisfying solution is to not miss the windows in the first place. Of course it could end up being impossible since macOS has no public APIs and AltTab is a mess of hacks with private APIs and SPIs, and playing with side-effects of the OS. Other workarounds could be considered though. Maybe periodically checking for windows, in case we missed some. Maybe something else, I'm not sure. I'll re-open the ticket and flag it as "breakthrough needed" in case somebody has a breakthrough idea to address this issue of missing some windows sometimes. Finally, I'd like to note how hard it would be to test such workaround since missing windows happens randomly, and pretty much never on my machine. |
@baggiponte you're saying that at the time you took the screenshot, Preview had a window open? Could you share that as well? |
Hi @lwouis, thanks for the prompt reply. Yes, at the time of the screenshot I had both Preview and Logseq windows opened. You mean sharing alt-tab panel when windows are opened? If so, I have attached the pic. I thought this happened because Preview windows were already open when I turned on my macbook, so I tried not to quit it and restart my machine, but they were correctly displayed. |
We has tickets in the past for apps that wouldn't show when launching/restoring their state at login-time. Do you think this issue happens to you often after you log in the computer? Another question: do any of these windows start on another Space, or in fullscreen? Regarding login-time, things are pretty complex. I don't even know clearly the difference between:
|
I'd say all the time: I have just logged in and launched logseq (it was not a restored window) and the same issue appeared.
I guess this must be it! I want windows to open fullscreen, so both Preview and Logseq opened in full. I tried to resize them, quit them and relaunch and AltTab did now display any issue! |
How do you set up Preview so that it opens windows fullscreen? The only way i know would be to open a window, fullscreen it, "quit and keep the windows" then re-open the app which will restore the windows directly in fullscreen. I don't know a way to have the first window open fullscreen. How do you do that? A video of the scenario would help me understand the steps you go through |
Hi @lwouis! Let's cast aside Preview, I cannot replicate the scenario (i.e. it opens correctly) and let's focus on Logseq. I am at odds. I do not really understand what is going on: sometimes Alt-Tab does not work. In the first video, I have just closed logseq fullscreen and relaunched it. It relaunches in fullscreen, reloads in fullscren and Alt-Tab shows a bug. first_screncast.movThe second video is taken right after the first one. Logseq is already open and I exit fullscreen (it may seem a bit confusing, because it is max width). I quit and relaunch it, so it reopens max width (but not fullscreen) and Alt-Tab works fine. Then I enter fullscreen, quit and relaunch, but Alt-Tab works. I do it once again and it works again. second_screencast.mov |
From the first video, I can see many phases/animations happening until the window is finally ready and stable. These must create problems with AltTab by breaking the private API tricks we do to detect such fullscreen windows (again, no public API can do this job). The fact that the issue is not happening every time is probably due to data-races with system events and these animations. I renamed the issue to be more specific. The next step is now for someone clever to figure out a workaround around this issue. |
I confirm this issue exists for me as well on a MacBook Pro M1 (MacOS 11.5.1) with reopened full screen windows, e.g. first-party applications Safari and Terminal, and third party applications, e.g. Notion, VS code. |
I'm also seeing this issue. I created an Alfred workflow to at least restart AltTab when this happens. |
I'm also having this issue pretty much all the time at login. Restarting AltTab fixes the issue, unfortunately I'm using multiple desktops/spaces so anything that is not on the current space doesn't generate thumbnails. If I quit and restart AltTab on a space, it only generates thumbnails for the windows on that space. |
Confirmed.
|
@lukasszz neither this ticket nor the one I linked is related to external displays. When you fullscreen a window on macOS, it puts it into its own dedicated Space. This creates all sorts of problem for AltTab since there is no public API to access windows in other Spaces than the current active Space. Thus we use private APIs and complex tricks to do the job. From macOS 12.2 onwards, it seems that one the private APIs were are using to make it happen has been broken by Apple, so users don't see windows from other Spaces (fullscreen windows are always on other Spaces). That's why I'm guessing you're on macOS 12.2 or 12.3, and you see issue #1324. This ticket here is more open windows that are restored after they were closed while fullscreen. See #1002 (comment) for more details |
Hey @koekeishiya, I was working on this, as well as #1467, and clarified/realized something: When an app is launching, there is a period of time where it may create windows, but even if we are observing its window-created events, we don't get notified. This happens for instance we you close an app without closing its windows, then when you relaunch that app, macOS will restore the windows. You could have 3 windows, but 0 notification about their creation. Instead today I'm doing tricks like looking at other events (e.g. new window focused for this app), and doing the AX call to list the windows of the app. Problem use-cases where this tends to happen:
For instance, the scenario I'm running that trips AltTab:
Do you know a better way to handle the windows created during launch? Since we don't get the notification, I can only imagine either on a schedule, or during some other notifications from the app (correlation). |
In yabai I run the grab AX windows for applications every time a space is changed and look for new windows, because of the "only shows AX-refs for current space" limitation. You could do this as well, and it would let you detect fullscreen windows after it has been activated once. To figure out if it is necessary to do the operation mentioned above (instead of doing it for every space change), you should be able to use I should probably make this change in yabai as well, instead of blindly running these every space change. Edit: Made these changes for yabai in commit: koekeishiya/yabai@2e3fb4a |
I've dug into this again today, and come to the conclusion that it falls under the umbrella of #447. Indeed, the issue here is the following:
This happens for instance when an app is opened, and some of its windows are restored. If they were fullscreen, they will be restored on other Spaces. Sometimes macOS will then automatically focus on another Space to show the newly open window, but there is an animation to get there which could mean we don't ask for windows during it, and we don't get the window. More importantly, sometimes macOS will not focus such initial window. For example, if the restored app had multiple windows fullscreen. Then it may focus on of those Space, but not both. Because we get no notification, and we don't travel to all relevant Spaces, we miss those windows. Let's thus focus the discussion in #447. |
Is your feature suggestion related to a problem? Please describe.
Sometimes not every window is shown in altTab but closing and reopening AltTab fixes the issue
Describe the solution you'd like
I think a simple "reload app windows" button in the top-bar menu could be helpful
thank you for your time
The text was updated successfully, but these errors were encountered: