-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
Fight with Ghost windows. Actively check for closed windows on every "refresh session" #445
Comments
Since the format string for list-windows allows to list process ID, can you ignore AXUIElement and just check whether the process connected to window still lives? Sure, it would not be perfect due to pid reuse, but should probably work well enough? |
This comment was marked as spam.
This comment was marked as spam.
I think i am having this issue too.. Sometimes what happens is : When I open a browser and some other app (lets say notes) in same workspace. It runs fine. But, when I close the notes, the browser doesn't automatically resize to fill the screen..It stays as it is. I have to quite aerospace and open it again to fix it again and again. |
This comment was marked as abuse.
This comment was marked as abuse.
As a stop gap, would it be possible to add a separate command such as 'aerospace kill-ghost-windows' ? Restarting aerospace is a bummer because I have to manually move all windows to correct workspaces... |
Alternatively, |
That's true. But, this can make your life easier till it gets fixed. Add lines like these for your frequently used apps in aerospace.toml [[on-window-detected]] [[on-window-detected]] [[on-window-detected]] It will automatically keep those apps in that specific workspace all the time. Also use option+x for closing windows instead of Cmd+W.. by adding this in your aerospace.toml alt-x = 'close' PS: I am using raycast so I can easily restart aerospace as I have assigned a shortcut [Control+~] for restart script |
Hi, I hit this issue quite often and it started to drive me crazy. I often take one of my browser tab to a separate window to see it side by side and every time I close it via After reading this issue commends the great hint is to use As a workaround I wrote little script to move all ghost windows to a designated workspace (called BIN) in my case. Then I have keyboard mapping Edit: the script would be better if it could kill the windows but when I try to kill a ghost window with |
@jknetl For me this script does not work since |
@dhruvasagar it does: https://nikitabobko.github.io/AeroSpace/commands#move-node-to-workspace Maybe it was added in a recent version? Have you tried upgrading? I am have version 0.15.2-Beta installed |
@jknetl I get the following error :
|
don't blindly uses other's scripts, that's the thing you should know. |
@litszwaiboris I never use any script blindly, I inspected and tested each command and looked at the documentation very carefully. I was sharing the error so someone would know that it doesn't work. |
Is this reproducible over certain MacOS and/or aerospace versions? I have two Apple computers with the following versions Mac Mini - no ghost window issues observed yet
MacOS Version: 15.0.1 (24A348) Macbook Pro - ghost windows happens anytime I cmd+w
MacOS Version: 15.1 (24B83) |
Ghost windows also appear in Xcode when using the new Xcode extension for GitHub Copilot. Should we report this issue to the developers of the affected apps? Is this something they can fix? |
…ook lid The problem with the MacBook lid is not 100% reproducible, it's flaky A follow up on #445 The change in MacApp.swift is insignificant, it just further reduces the chance of detecting problematic ax events.
The potential fix was committed to I am going to test it for a few days before making the release. I encourage everyone to do the same and report back. Please follow https://github.com/nikitabobko/AeroSpace/blob/main/dev-docs/development.md for the project setup, you can use I'm especially interested to see if something breaks if macOS goes to sleep, MacBook lid closes, screensaver activates, and you can add monitor configuration changes on top of it while everything mentioned is happening. These kind of circumstances. The problem here is that when you lock the screen, go to sleep, etc. all windows are indistinguishable from closed, and AeroSpace has to restrain itself from destroying those windows if it detects sleep/locked_screen, detecting of which is itself turned out being fragile. |
#445 This commit is not necessary, it just makes me sleep better
Hi @nikitabobko, Thank you for your continued work on resolving this issue. I appreciate the detailed instructions and the potential fix you've committed to the main branch. I've installed the latest commit
I'll continue testing under different conditions, including those you mentioned (e.g., sleep mode, screen locking, etc.), and will report back with any further findings. Let me know if there's anything specific you'd like me to test. Thanks again for your efforts! |
@FelixLisczyk thanks for letting me know. The problem in your second bullet point should be fixed in 00cbb63 You can update by running |
@nikitabobko Just Installed from sources.. |
@aintyourcupoftea I haven't been able to reproduce this issue yet. Are you using the latest commit 00cbb63? You can check by looking at the top of the AeroSpace menu bar app. Also make sure that both the server and the client are using the same version:
My steps for reproducing the issue were:
|
@nikitabobko The problem looks fixed for me, thank you! |
@FelixLisczyk I am sorry.. I am not able to produce the problem consistently. It just happens sometimes. So, I think that this commit can be released. |
I ran it for a day. I did have a window (vscode) that didn't expand until a mouse click. I forgot how I got there and what exactly I did. But it fixed itself, so not a problem. Sleeping / logging off / update to 15.1. It works. Thanks @nikitabobko ! |
I've been using the debug version as well and the issue with ghost windows appears to be gone. Occasionally, after closing a window, the windows will only resize after I hit a shortcut key. I couldn't figure out the steps to reproduce it yet, but it's a lot less intrusive than the ghost windows sticking around. Now the main issue with ghost windows appear to be go, I'm wondering when a release with the fix will be officially launched? |
I wasn't able to build locally so I leverage the GitHub actions and uploaded the built artifect here https://github.com/lazywei/AeroSpace/actions/runs/11826773439 In case anyone also interested in getting the latest build before the release is made. (download link for AeroSpace.app and the binary https://github.com/lazywei/AeroSpace/actions/runs/11826773439/artifacts/2184714023) |
This comment was marked as off-topic.
This comment was marked as off-topic.
The cache is used restore windows that were mistakenly garbage collected because of lock screen #445
The fix is released in 0.16.0-Beta |
macOS AX callbacks are unreliable. Sometimes windows can close but the
kAXUIElementDestroyedNotification
callback is not invoked (e.g. if user quickly closes several windows in a row)AeroSpace already checks for new appeared windows on every "refresh session" to fight unreliable
kAXWindowCreatedNotification
callback.The only window state that AeroSpace doesn't actively check for is when the window is closed. Currently AeroSpace "forgets" about windows only if
kAXUIElementDestroyedNotification
is invoked for them.The reason for it is because I didn't find yet a reliable way to detect that
AXUIElement
is no longer valid. One approach that I tried before is to check that_AXUIElementGetWindow
returnsnil
. Unfortunately,_AXUIElementGetWindow
returnsnil
for everyAXUIElement
when the screen is lockedThis issue should fix the problem that sometimes windows are "stuck", and AeroSpace thinks that they still exist when they don't
UPD: In Sequoia, using some apps may cause macOS to (completely?) stop sending
kAXUIElementDestroyedNotification
. Known apps, that interfere with AeroSpace: contexts app, Amazon QThe text was updated successfully, but these errors were encountered: