From 99af0f8f7b453f9cfd520c19118aca47dbd927f4 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Wed, 21 Dec 2022 15:36:52 -0800 Subject: [PATCH] fix(wm): make force-focus command read wm state This commit ensures that the force-focus command reads the window manager state to get the coordinates of the window that should be currently focused, places the cursor in the middle of that rect, and then simulates a left-click. --- komorebi/src/process_command.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/komorebi/src/process_command.rs b/komorebi/src/process_command.rs index cfcd5c7e..70da5f2b 100644 --- a/komorebi/src/process_command.rs +++ b/komorebi/src/process_command.rs @@ -181,6 +181,9 @@ impl WindowManager { self.cycle_container_window_in_direction(direction)?; } SocketMessage::ForceFocus => { + let focused_window = self.focused_window()?; + let focused_window_rect = WindowsApi::window_rect(focused_window.hwnd())?; + WindowsApi::center_cursor_in_rect(&focused_window_rect)?; WindowsApi::left_click(); } SocketMessage::Close => self.focused_window()?.close()?,