Skip to content

fix: Some applications' (Microsoft Word) closing event not detected#372

Open
AdamGaskins wants to merge 1 commit into
acsandmann:mainfrom
AdamGaskins:feature/remove-stale-windows
Open

fix: Some applications' (Microsoft Word) closing event not detected#372
AdamGaskins wants to merge 1 commit into
acsandmann:mainfrom
AdamGaskins:feature/remove-stale-windows

Conversation

@AdamGaskins

@AdamGaskins AdamGaskins commented May 30, 2026

Copy link
Copy Markdown

I have the great privilege (sarcasm) of using Microsoft Products at work, but when clicking X, Rift would leave empty space for them until the next time stale windows were cleared. This was happening for me in Microsoft Teams, Excel, Powerpoint and Word.

The issue seems to be that when these particular windows are closed, a WindowClosed event is not being fired, but only a kAXUIElementDestroyedNotification event. However in a kAXUIElementDestroyedNotification event, the window has already been destroyed, so trying to get the window/process id returns AXError(-25202) kAXErrorInvalidUIElement.

A few years ago, AeroSpace stopped removing windows on kAXUIElementDestroyedNotification events and instead just refreshing the window list. Commit | Current status of main

This PR is a 1 line change to implement the same thing, and from my testing solves the issue.

@AdamGaskins AdamGaskins changed the title fix: Remove stale windows on kAXUIElementDestroyedNotification fix: Some applications (Microsoft Word) closing event not detected May 30, 2026
@AdamGaskins AdamGaskins changed the title fix: Some applications (Microsoft Word) closing event not detected fix: Some applications' (Microsoft Word) closing event not detected May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant