From e3dd3c60de6e155e2059e45d89aff683fd7f13e4 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Wed, 28 Oct 2026 11:45:19 -0700 Subject: [PATCH] fix(scrolling): refocus after a window is closed with Hide Closing a window sends Hide and not Destroy to many applications. The Hide arm re-tiled without asking Windows to focus the surviving window, so no window had the foreground and the border did not follow focus. Use the same refocus rule as the Destroy arm. --- komorebi/src/process_event.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/komorebi/src/process_event.rs b/komorebi/src/process_event.rs index 65fb9f3f..2c1e5d1e 100644 --- a/komorebi/src/process_event.rs +++ b/komorebi/src/process_event.rs @@ -390,7 +390,12 @@ impl WindowManager { if hide { self.focused_workspace_mut()?.remove_window(window.hwnd)?; - self.update_focused_workspace(false, false)?; + + // Closing a window sends Hide and not Destroy to many applications, so + // hand focus on to the surviving window as the Destroy arm does + let refocus = + should_refocus_after_destroy(WindowsApi::foreground_window().ok()); + self.update_focused_workspace(refocus, refocus)?; } let mut already_moved_window_handles = self.already_moved_window_handles.lock();