Description
When opening the launcher (e.g. via super+d) and then closing it (via Esc or super+d again), the previously focused window loses focus. Instead, the window under the mouse cursor gets focused.
This is problematic when your keyboard focus is on a different window than where the mouse is — after dismissing the launcher, focus jumps to the wrong window. It's especially annoying with groups, where you want to launch an app into the focused group but it ends up on a different window/workspace because focus shifted to wherever the mouse was.
Steps to Reproduce
- Focus a window (e.g. click on it or alt-tab to it)
- Move the mouse cursor over a different window (don't click)
- Open the launcher (
super+d)
- Close the launcher (
Esc or super+d)
- Observe: focus is now on the window under the mouse, not the previously focused window
Root Cause
In modules/drawers/Drawers.qml, the layer shell keyboard focus is set based on launcher visibility:
WlrLayershell.keyboardFocus: visibilities.launcher || visibilities.session ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
When the launcher closes, keyboard focus becomes None, and Hyprland's default behavior focuses the window under the cursor. No previous focus tracking or restoration is implemented.
Expected Behavior
After dismissing the launcher, focus should return to the window that was focused before the launcher was opened.
Suggested Fix
- Store the active window address (via Hyprland IPC) before the launcher opens
- Restore focus to that window (e.g.
hyprctl dispatch focuswindow address:...) when the launcher closes
Description
When opening the launcher (e.g. via
super+d) and then closing it (viaEscorsuper+dagain), the previously focused window loses focus. Instead, the window under the mouse cursor gets focused.This is problematic when your keyboard focus is on a different window than where the mouse is — after dismissing the launcher, focus jumps to the wrong window. It's especially annoying with groups, where you want to launch an app into the focused group but it ends up on a different window/workspace because focus shifted to wherever the mouse was.
Steps to Reproduce
super+d)Escorsuper+d)Root Cause
In
modules/drawers/Drawers.qml, the layer shell keyboard focus is set based on launcher visibility:When the launcher closes, keyboard focus becomes
None, and Hyprland's default behavior focuses the window under the cursor. No previous focus tracking or restoration is implemented.Expected Behavior
After dismissing the launcher, focus should return to the window that was focused before the launcher was opened.
Suggested Fix
hyprctl dispatch focuswindow address:...) when the launcher closes