From 01d14b2c0c6446ac17162ef38dc2a37071beb121 Mon Sep 17 00:00:00 2001 From: Loren Eteval Date: Sat, 31 May 2025 22:18:48 +0800 Subject: [PATCH] Format source Signed-off-by: Loren Eteval --- Furious/Widget/Application.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Furious/Widget/Application.py b/Furious/Widget/Application.py index aafcdf6a..0b62bccb 100644 --- a/Furious/Widget/Application.py +++ b/Furious/Widget/Application.py @@ -288,14 +288,16 @@ class Application(ApplicationFactory, SingletonApplication): NSApplication.sharedApplication().setActivationPolicy_(policy) def eventFilter(self, obj, event): - # Show Dock icon on macOS when window is shown and hide only when window is closed (not minimized) + # Show Dock icon on macOS when window is shown + # and hide only when window is closed (not minimized) if PLATFORM == 'Darwin' and obj is getattr(self, 'mainWindow', None): - if event.type() == QtCore.QEvent.Show: + if event.type() == QtCore.QEvent.Type.Show: self._setDockIconVisible(True) - elif event.type() == QtCore.QEvent.Hide: + elif event.type() == QtCore.QEvent.Type.Hide: # Hide Dock icon when window is closed (not minimized) if not self.mainWindow.isMinimized(): self._setDockIconVisible(False) + return super().eventFilter(obj, event) def exit(self, exitcode=0): @@ -400,6 +402,7 @@ class Application(ApplicationFactory, SingletonApplication): self.mainWindow = AppMainWindow() self.systemTray = SystemTrayIcon() + if PLATFORM == 'Darwin': # Install event filter for main window to track show/hide self.mainWindow.installEventFilter(self)