Skip to content

hyprland/ipc: don't bring back windows that already closed - #1490

Open
samanyudas wants to merge 1 commit into
quickshell-mirror:masterfrom
samanyudas:fix/hyprland-closed-toplevel-resurrection
Open

samanyudas wants to merge 1 commit into
quickshell-mirror:masterfrom
samanyudas:fix/hyprland-closed-toplevel-resurrection

Conversation

@samanyudas

Copy link
Copy Markdown

Describe your changes

A window that closes while refreshToplevels() is waiting for j/clients can come back as a ghost. Quickshell handles closewindow first, then the older reply re-creates the window. Nothing removes it again until the shell restarts (#1268).

So now Quickshell remembers windows that close while it waits, and skips them in the reply.

Details and descisions

I only skip windows I know closed. Removing every window missing from the reply would also remove windows that opened after the reply was made.

openwindow clears the note, because Hyprland reuses addresses.

AI context (Claude Opus 5.5 helped find and fix this)

A Cap user hit this through Omarchy 4.5's bar. The bar ignores clicks while a fullscreen window is open on its monitor. After Cap's screen picker closed, the bar stayed dead until they restarted the shell (CapSoftware/Cap#4119).

The repro branch makes it happen every time. It runs Quickshell against a fake Hyprland server that sends closewindow before the old j/clients reply. Run repro-1268/run.sh <path-to-quickshell> from https://github.com/samanyudas/quickshell/tree/repro/1268-fake-hyprland.

Build 5 runs
master 9b0f339 ghost every time
Arch package 0.3.1 ghost every time
this branch clean every time

On real Hyprland 0.56.2, master brought back 29 closed windows in 30 tries. This branch brought back none.

Quickshell only notes closes while a reply is pending. It clears the notes when the reply arrives, even if the request failed. openwindow clears an address first thing, so a new window that reuses the address is never skipped.

Open concerns

An existing window can still get stale fields from an old reply. That's the same race, but it fixes itself on the next refresh, so I left it out.

The same race exists for workspaces (#1250) and window moves (#1467). Windows created from windowtitlev2 that never map are a separate case (#1450). This PR doesn't touch them.

Participation

I will follow the review, make changes and like to learn this part of the code.

A window that closes while `refreshToplevels()` is waiting for
`j/clients` can come back as a ghost. Quickshell handles `closewindow`
first, then the older reply re-creates the window. Nothing removes it
again until the shell restarts (quickshell-mirror#1268).
@samanyudas samanyudas changed the title hyprland/ipc: don't recreate toplevels closed during a j/clients request hyprland/ipc: don't bring back windows that already closed Nov 14, 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