From 5006aa90098582ddcd04334c80c0b5df1112072c Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sun, 28 Aug 2022 08:09:08 -0700 Subject: [PATCH] fix(wm): give focus priority to monocle containers This commit ensures that monocle containers are given priority when handling WindowManagerEvent::FocusChange. This is especially important when switching workspaces to ensure that the keyboard input focus stays with the monocle container's focused window when returning to a workspace with a monocle container activated. fix #219 --- komorebi/src/process_event.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/komorebi/src/process_event.rs b/komorebi/src/process_event.rs index a295eec4..56263573 100644 --- a/komorebi/src/process_event.rs +++ b/komorebi/src/process_event.rs @@ -198,8 +198,14 @@ impl WindowManager { } } - self.focused_workspace_mut()? - .focus_container_by_window(window.hwnd)?; + if let Some(monocle) = workspace.monocle_container() { + if let Some(window) = monocle.focused_window() { + window.focus(false)?; + } + } else { + self.focused_workspace_mut()? + .focus_container_by_window(window.hwnd)?; + } } } WindowManagerEvent::Show(_, window) | WindowManagerEvent::Manage(window) => {