Skip to content

fix(wm): don't leave focus follows mouse stuck after a skipped raise - #1776

Open
totallynotrajat wants to merge 1 commit into
LGUG2Z:masterfrom
totallynotrajat:fix/ffm-pending-raise-stuck
Open

totallynotrajat wants to merge 1 commit into
LGUG2Z:masterfrom
totallynotrajat:fix/ffm-pending-raise-stuck

Conversation

@totallynotrajat

@totallynotrajat totallynotrajat commented Nov 22, 2026 •

Copy link
Copy Markdown

Problem

With --ffm and focus_follows_mouse: Komorebi, hover focus can stop working entirely until it is toggled off and on (komorebic state shows "has_pending_raise_op": true and it never clears).

raise_window_at_cursor_pos first looks for a container under the cursor on the focused workspace. When the cursor is over workspace/container padding, a gap, or a bar, that finds nothing and it falls back to checking every workspace. A fullscreen window on a hidden workspace covers the whole monitor, so it matches. A Raise event is sent for it, and has_pending_raise_op is set to true. process_event then returns early (the window is hidden/unmanaged) before it reaches the Raise arm, which is the only place the flag is cleared. Every later hover returns early on has_pending_raise_op.

Reproduction

  1. Start komorebi with --ffm, komorebic focus-follows-mouse enable --implementation komorebi.
  2. Workspace 1: two tiled windows. Workspace 2: one window, fullscreen.
  3. On workspace 1, move the pointer into the gap between the two tiles.
  4. komorebic state | grep has_pending_raise_op is now true; hovering the tiles no longer focuses them.

Fix

  • Only search each monitor's focused workspace in the fallback.
  • Clear has_pending_raise_op after a Raise event is handled, whatever process_event returned.

Testing

Built on Windows 11 with MSVC (VS 2022 Build Tools), cargo build -p komorebi -p komorebic. Setup: workspace 1 has two tiled windows, workspace 2 has one fullscreen window, komorebi.exe --ffm, hover focus enabled with komorebic focus-follows-mouse enable --implementation komorebi. A script moves the pointer (relative mouse_event moves) over the left tile, the right tile, the gap between them, then both tiles again, and after each step prints the foreground window and has_pending_raise_op from komorebic state.

Before (installed nightly 72aa4c9): hovering the gap sets the flag, and the next hovers no longer move focus (the foreground stays on the right tile).

== BEFORE: installed nightly 72aa4c9 (--ffm)  (left=27199496 right=14485748 gap x=960)
hover left tile    foreground=27199496   "has_pending_raise_op": false,
hover right tile   foreground=14485748   "has_pending_raise_op": false,
hover the gap      foreground=14485748   "has_pending_raise_op": true,
hover left tile    foreground=14485748   "has_pending_raise_op": true,
hover right tile   foreground=14485748   "has_pending_raise_op": true,

After (this branch):

== AFTER: patched build ac6ecac (--ffm)  (left=27199496 right=14485748 gap x=960)
hover left tile    foreground=27199496   "has_pending_raise_op": false,
hover right tile   foreground=14485748   "has_pending_raise_op": false,
hover the gap      foreground=14485748   "has_pending_raise_op": false,
hover left tile    foreground=27199496   "has_pending_raise_op": false,
hover right tile   foreground=14485748   "has_pending_raise_op": false,

cargo test -p komorebi --lib: 219 passed, 2 failed (monitor::tests::test_move_container_to_workspace and test_move_container_to_nonexistent_workspace). The same two fail on unpatched master.

I know FFM is no longer actively developed (#1044); this is a small fix in case it is still wanted.

raise_window_at_cursor_pos falls back to searching every workspace when
the cursor is not over a container on the focused workspace (padding,
gaps, the bar). A window on a hidden workspace (e.g. a fullscreen one)
can match, and its Raise event is dropped before process_event reaches
the handler that clears has_pending_raise_op. The flag then stays true
and focus follows mouse never raises again until it is toggled.

Only search each monitor's focused workspace, and always clear the flag
once a Raise event has been handled, whatever process_event returned.
@totallynotrajat
totallynotrajat force-pushed the fix/ffm-pending-raise-stuck branch from ac6ecac to 92ce890 Compare November 22, 2026 23:51
@totallynotrajat
totallynotrajat marked this pull request as ready for review November 22, 2026 23:52
Copilot AI balanced review requested due to automatic review settings November 22, 2026 23:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants