From 323be435564bbc996f595f74798ca31b955a3be8 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Thu, 9 Apr 2026 20:55:05 -0700 Subject: [PATCH] fix(wm): keep mouse on monocle when toggling w/ mff This commit fixes a bug where, when toggling on monocle mode, the cursor would go to the configured hiding corner. Thanks to ziggee on Discord for pointing this out because I hadn't noticed it despite using monocle mode all the time! --- komorebi/src/window_manager.rs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/komorebi/src/window_manager.rs b/komorebi/src/window_manager.rs index fd2b50bd..6459b85e 100644 --- a/komorebi/src/window_manager.rs +++ b/komorebi/src/window_manager.rs @@ -924,11 +924,23 @@ impl WindowManager { .ok_or_eyre("there is no monitor")? .update_focused_workspace(offset)?; - if follow_focus - && let Ok(window) = self.focused_window_mut() - && trigger_focus - { - window.focus(mouse_follows_focus)?; + if follow_focus && trigger_focus { + // When a monocle container is active, workspace.update() already positioned it at + // the work area. Focus that window directly so the cursor follows the monocle + // window's actual on-screen position, not a hidden tiling container at the hiding + // corner. + let monocle_window = self + .focused_workspace_mut()? + .monocle_container + .as_mut() + .and_then(|c| c.focused_window_mut()) + .cloned(); + + if let Some(window) = monocle_window { + window.focus(mouse_follows_focus)?; + } else if let Ok(window) = self.focused_window_mut() { + window.focus(mouse_follows_focus)?; + } } Ok(())