From 01b2c524609805ff6b702db0a585d740274fa1ee Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Mon, 8 Aug 2022 19:00:08 -0700 Subject: [PATCH] fix(wm): handle settings window focus gracefully This commit ensures that failures to focus on the Settings and similar windows on Windows 11 will allow execution to continue so that the active window border location can be updated without exiting early from the command handler with a propagated error. --- komorebi/src/window.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/komorebi/src/window.rs b/komorebi/src/window.rs index d13ac93a..7acf286f 100644 --- a/komorebi/src/window.rs +++ b/komorebi/src/window.rs @@ -243,7 +243,17 @@ impl Window { } // This isn't really needed when the above command works as expected via AHK - WindowsApi::set_focus(self.hwnd()) + match WindowsApi::set_focus(self.hwnd()) { + Ok(_) => {} + Err(error) => { + tracing::error!( + "could not set focus, but continuing execution of focus(): {}", + error + ); + } + }; + + Ok(()) } #[allow(dead_code)]