From 4b58157c090d71d0b9d126620ab32f07441abe2d Mon Sep 17 00:00:00 2001 From: AuroraWright Date: Thu, 29 Feb 2024 18:44:02 +0100 Subject: [PATCH] Fix minor issues --- owocr/run.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/owocr/run.py b/owocr/run.py index ebf44a3..235adf5 100644 --- a/owocr/run.py +++ b/owocr/run.py @@ -182,7 +182,7 @@ class MacOSWindowTracker(threading.Thread): if len(window_list) > 0: found = True is_active = False - if self.window_active != is_active: + if found and self.window_active != is_active: on_window_activated(is_active) self.window_active = is_active time.sleep(0.2) @@ -202,8 +202,10 @@ class WindowsWindowTracker(threading.Thread): def run(self): found = True - while found and not self.stop: + while not self.stop: found = win32gui.IsWindow(self.window_handle) + if not found: + break if self.only_active: is_active = self.window_handle == win32gui.GetForegroundWindow() if self.window_active != is_active: