drawers: restore focus to previous window on dismiss#1323
Open
1letme wants to merge 1 commit into
Open
Conversation
When a drawer (launcher, session, sidebar, dashboard) is opened, the HyprlandFocusGrab takes keyboard focus away from the active window. On dismiss, focus was not restored, causing Hyprland to fall back to focusing whatever window is under the mouse cursor. This stores the active window address when the focus grab activates and dispatches focuswindow to restore it when the grab deactivates.
bc49983 to
8e0cfbd
Compare
Collaborator
|
This is not a bug with Caelestia, it is simply how Hyprland focus grabs behave by default. Your mouse will still change the window focus if you move it to hover over another window while the focus grab is active, just that it will not receive mouse events. Hmm, actually I see what you mean. Even if you don't move the mouse it won't focus back the original window if your mouse if over another. But this is still an issue with Hyprland, not Caelestia. |
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.
Fixes #1322
What this does
When a drawer (launcher, session, sidebar, dashboard) is opened via
HyprlandFocusGrab, it takes keyboard focus from the active window. Previously, when the drawer was dismissed (via Escape, keybind toggle, or clicking outside), focus was not restored to the previously active window. Hyprland would then fall back to focusing whatever window happened to be under the mouse cursor.This patch stores the active toplevel's address when the focus grab activates, and dispatches
focuswindowto restore it when the grab deactivates.How it works
onActiveChangedhandler on the existingHyprlandFocusGrabactivebecomestrue: savesHypr.activeToplevel.lastIpcObject.addressactivebecomesfalse: dispatchesfocuswindow address:0x{saved}to restore focusBreaking changes
None.
Side effects
This also restores focus after dismissing the session menu, sidebar, and dashboard, not just the launcher. This should be the expected behavior for all of these.