From 627088c9b9f55c079266e84e02dedcfdf9d40157 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Mon, 6 May 2024 18:25:43 -0700 Subject: [PATCH] fix(wm): focus workspaces on cross-monitor cmds This commit ensures that if a window is moved to a workspace on another monitor which is not the currently focused workspace on that monitor, the target workspace will be focused as part of the operation. --- komorebi/src/window_manager.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/komorebi/src/window_manager.rs b/komorebi/src/window_manager.rs index 99965017..62bd6f24 100644 --- a/komorebi/src/window_manager.rs +++ b/komorebi/src/window_manager.rs @@ -1205,6 +1205,7 @@ impl WindowManager { let monitor = self .focused_monitor_mut() .ok_or_else(|| anyhow!("there is no monitor"))?; + let workspace = monitor .focused_workspace_mut() .ok_or_else(|| anyhow!("there is no workspace"))?; @@ -1225,6 +1226,11 @@ impl WindowManager { .ok_or_else(|| anyhow!("there is no monitor"))?; target_monitor.add_container(container, workspace_idx)?; + + if let Some(workspace_idx) = workspace_idx { + target_monitor.focus_workspace(workspace_idx)?; + } + target_monitor.load_focused_workspace(mouse_follows_focus)?; target_monitor.update_focused_workspace(offset)?;