Repository navigation
Conversation
Some clients will set a window's title without ever mapping it. Since the window is never mapped, Hyprland will never send a closewindow event. If quickshell preemptively creates a toplevel from the windowtitlev2 event, it will never be removed from Hyprland.toplevels. The openwindow event already carries the window's current title, so waiting to create the toplevel doesn't actually lose any information.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
When Quickshell receives one of
windowtitlev2,activewindowv2, orurgentfrom Hyprland for a window that has not been mapped, it will preemptively add the window toHyprland.toplevels. If the window is never mapped, then Hyprland never sends aclosewindowevent, so the entry will stay in the list forever. One application which does this is Steam, which sets the titles of several windows which are never mapped. After starting and exiting the Steam client, Quickshell still tracks several phantom windows:My PR changes the current behavior so Quickshell will no longer preemptively add a new toplevel on a
windowtitlev2event. It does not change how any other event types are handled.Since
toplevelcan now be null, the log message directly after can now get sent. I've changed it from a warning to a debug message.This technically fixes the main problem described in #1450, although that issue also brings up the fact that
refreshToplevelsdoesn't prune, which is not addressed by this PR.Details and descisions
The original code had a comment:
However, nothing is gained by adding the toplevel before the
openwindowevent, sinceopenwindowcarries the window's current title. That means that if thewindowtitlev2event comes first, the title it sets will be overwritten anyway when the window actually gets mapped.The submitter of #1450 suggested a couple of possible fixes:
refreshToplevelsclean up stale entries. I think this is probably a change worth doing, but not really relevant to this issue. The methodrefreshToplevelsdoesn't usually get called that often and the toplevel state is supposed to be updated as the events come in.windowtitlev2. The only real world examples of this issue I have seen have involvedwindowtitlev2, not the other events.AI usage
I used an LLM to identify the relevant section of the code, write test scripts, and gain a better understanding of the codebase. I've attached a script to reproduce the bug.
AI generated test script
Open concerns
From further testing, it seems that Hyprland will not emit an
activewindowv2event for an unmapped window. However, it can do this forurgent, although I have not encountered this in a real application.Participation
I will follow up on any responses to this PR and also intend to make further contributions to Quickshell in the future.