From f8120f6b11506fe20d9f039b59f95dbe96b6de2e Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 21 Jan 2023 08:01:01 -0800 Subject: [PATCH] fix(wm): correct logic for foreground access retry --- komorebi/src/window.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/komorebi/src/window.rs b/komorebi/src/window.rs index 2748a6b2..03d5a900 100644 --- a/komorebi/src/window.rs +++ b/komorebi/src/window.rs @@ -283,8 +283,9 @@ impl Window { // If this still doesn't work then maybe try https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-locksetforegroundwindow if !tried_resetting_foreground_access { let process_id = WindowsApi::current_process_id(); - WindowsApi::allow_set_foreground_window(process_id)?; - tried_resetting_foreground_access = true; + if WindowsApi::allow_set_foreground_window(process_id).is_ok() { + tried_resetting_foreground_access = true; + } } } };