fix(movetoworkspace): follow floating window to destination monitor#305
Open
sim590 wants to merge 3 commits into
Open
fix(movetoworkspace): follow floating window to destination monitor#305sim590 wants to merge 3 commits into
sim590 wants to merge 3 commits into
Conversation
When a floating window is moved to another workspace with follow=true, node is nullptr so the original node->focus() call was skipped (guard added in previous fix). As a result, fullWindowFocus was never called and the active monitor remained the origin monitor. Call fullWindowFocus directly on the focused floating window so that the active monitor is updated correctly after the move.
…ng window fullWindowFocus does not call rawMonitorFocus directly. The monitor focus was only updated as a side effect of cursor warping via simulateMouseMovement, which is skipped when input:follow_mouse is 0 or when the cursor is already within the window's new bounds. Call rawMonitorFocus with the destination monitor explicitly after fullWindowFocus and warpCursorToBox so that the active monitor is reliably updated on every move, regardless of cursor position or follow_mouse setting.
…s floating When follow=true and a floating window was moved, getWorkspaceFocusedNode may return a non-null hy3 node from the origin workspace (a tiled window). The if (node != nullptr) branch then focused that tiled window instead of the floating window we just moved, losing both keyboard and monitor focus. Track whether the move was for a floating window and skip the node focus path in that case, always falling through to the floating window follow logic instead.
sim590
force-pushed
the
fix/movetoworkspace-floating-focus
branch
from
May 27, 2026 18:39
5b1f0d2 to
3a7de57
Compare
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.
Problem
When a focused floating window is moved to another workspace with
follow=true(e.g. viahy3:movetoworkspace <ws>,follow), keyboard focus and active monitor do not reliably follow the window.Two bugs combine to cause this:
1. Wrong follow path when a tiled window exists on the origin workspace
getWorkspaceFocusedNode(origin)returns the hy3 node of a tiled window on the origin workspace even though the focused window is floating (and has no hy3 node). Theif (node != nullptr)branch in the follow block then callsnode->focus()on that tiled window, stealing both keyboard focus and active monitor from the floating window we just moved.2. Monitor focus not explicitly updated
fullWindowFocusandmonitor->changeWorkspacedo not callrawMonitorFocusdirectly. Monitor focus only updates as a side-effect of cursor warping viasimulateMouseMovement, which is skipped whenmisc:mouse_move_focuses_monitor = 0or the cursor is already within the window bounds.Fix
moved_floatingto track whether the dispatched action moved a floating window. When true, skip thenode->focus()path in the follow block even ifnode != nullptr.fullWindowFocuson the floating window to set keyboard focus with a keybind reason (hard focus), regardless ofinput:follow_mouse.rawMonitorFocuswith the destination monitor explicitly so the active monitor is always correct, regardless of cursor position ormisc:mouse_move_focuses_monitor.Reproduction
mod+orepeatedly — before this fix, focus would jump to the tiled window after the first move