Skip to content

Add window-closed event to subscribe command - #2199

Closed
mvulin11 wants to merge 1 commit into
nikitabobko:mainfrom
mvulin11:feat/window-closed-event
Closed

Add window-closed event to subscribe command#2199
mvulin11 wants to merge 1 commit into
nikitabobko:mainfrom
mvulin11:feat/window-closed-event

Conversation

@mvulin11

Copy link
Copy Markdown

PR checklist

  • Explain your changes in the relevant commit messages rather than in the PR description. The PR description must not contain more information than the commit messages (except for images and other media).
  • Each commit must explain what/why/how and motivation in its description. https://cbea.ms/git-commit/
  • Don't forget to link the appropriate issues/discussions in commit messages (if applicable).
  • Each commit must be an atomic change (a PR may contain several commits). Don't introduce new functional changes together with refactorings in the same commit.
  • ./test.sh exits with non-zero exit code. (swift test: 382 tests, 0 failures)
  • Avoid merge commits, always rebase and force push.

Single atomic commit; full motivation and design notes (including the lock-screen / closed-windows-cache interaction) are in the commit message. Related: #445.

🤖 Generated with Claude Code

Broadcast window-closed from MacWindow.garbageCollect - the single funnel
every close goes through (user close, app termination, close command).
Payload mirrors window-detected: windowId, workspace, appBundleId, appName.

Locking the screen makes all windows unobservable, which garbage collects
them into the closed-windows cache and now emits window-closed. To keep
subscribers' bookkeeping balanced, restoring a window from the cache (which
deliberately skips on-window-detected callbacks) now broadcasts a matching
window-detected event.

Closes the gap tracked in nikitabobko#445 for subscribe consumers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
mvulin11 added a commit to mvulin11/AeroSpace that referenced this pull request Jul 23, 2026
…opened

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@nikitabobko

Copy link
Copy Markdown
Owner

Locking the screen makes all windows temporarily unobservable, which emits window-closed for them; a matching window-detected is emitted for each window when it is restored on unlock.

That is exactly one of the reasons why I don't want to expose window-closed event to users. Window death during screen lock is something AeroSpace has to deal with, not users.

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.

2 participants