Repository navigation
Vouch request: Fix floating focus history on close (#12585) #130
Replies: 3 comments 1 reply
elaborate. The description smells AI to me. |
|
fair enough, let me be 100% real with you: im still learning C right now and definitely not a C++ dev, but hyprland is my daily driver on arch and i ran into #12585 myself. it was annoying me that closing a floating window kept bouncing focus to random background tiled windows instead of the floating window right next to it. since i didnt know the codebase or modern c++ syntax, i used an ai coding agent to help me dig through the repo and write the patch. but i followed the logic of what it was doing: first, CWindowHistoryTracker was only listening to window.active, so closed windows were lingering in m_history until gc. it was basically trying to focus windows that were already dying, so we added the window.close listener to erase them immediately. second, getNextCandidate was looping through history without checking if the window was the one being closed, or if it was hidden/unmapped. and third, in the fallback path when history was empty, it was hardcoded to check tiled windows before floating windows. so even if you were closing a floating window, tiled always stole focus. we just made it check floating targets first if the closed window was floating. i had it add a test in hyprtester for it too (spawning A tiled, B and C floating, and checking that killing C focuses B, then A) and compiled it locally with ninja to make sure it builds clean. wanted to be completely honest about how i made it. if that breaks the vouch policy i totally understand and respect your decision, but the fix works and the logic makes sense. so maybe |
|
all good. Welcome aboard! |
Uh oh!
There was an error while loading. Please reload this page.
Repos I am interested in contributing to
hyprland, hyprlock, hypridle
What I want to contribute right now
hyprwm/Hyprland#16785
Why the above bug / feature specifically?
Addresses issue #12585 ("History is ignored if last window was floating, we close floating") and discussion #12578.
When closing a floating window that was spawned from another floating window, focus previously prioritized tiled windows over the previous floating window in MRU order. This PR ensures closed windows are promptly removed from history tracker, validates candidate window state in getNextCandidate, and prioritizes floating targets in the fallback path when the closed window was floating. Cleanly compiled and verified with an accompanying hyprtester integration test.
I acknowledge that:
I have read the AI Usage Policy and agree to follow it.
I have read the Code of Conduct and agree to follow it.
I wrote this request with my own hands, my own keyboard, and in my own words.
All reactions