diff --git a/Furious/QtFramework/QtWidgets.py b/Furious/QtFramework/QtWidgets.py index 5ab43f39..7a82a9a7 100644 --- a/Furious/QtFramework/QtWidgets.py +++ b/Furious/QtFramework/QtWidgets.py @@ -106,8 +106,6 @@ class AppQDialog(QTranslatable, SupportConnectedCallback, QDialog): if PLATFORM == 'Darwin': if self._firstShowCall: - APP().processEvents() - self.setWidthAndHeight() self._firstShowCall = False @@ -289,16 +287,16 @@ class AppQMainWindow( if PLATFORM == 'Darwin': if self._firstShowCall: - APP().processEvents() - self.setWidthAndHeight() - APP().processEvents() - self._firstShowCall = False moveToCenter(self) + if PLATFORM == 'Darwin': + self.activateWindow() + self.raise_() + def closeEvent(self, event): event.ignore() diff --git a/Furious/Widget/Application.py b/Furious/Widget/Application.py index f55cc0d5..f49a8a04 100644 --- a/Furious/Widget/Application.py +++ b/Furious/Widget/Application.py @@ -383,6 +383,18 @@ class Application(ApplicationFactory, SingletonApplication): if AppSettings.isStateON_('DarkMode'): self.switchToDarkMode() + def onApplicationStateChange(state): + if state == QtCore.Qt.ApplicationState.ApplicationActive: + if ( + not self.mainWindow.isVisible() + and not self.systemTray.ConnectAction.isConnecting() + ): + self.mainWindow.show() + + if PLATFORM == 'Darwin': + # Ensure the main window is shown when the dock icon is clicked + self.applicationStateChanged.connect(onApplicationStateChange) + self.systemTray.show() self.systemTray.setCustomToolTip() self.systemTray.bootstrap() diff --git a/Furious/Widget/ConnectProgressBar.py b/Furious/Widget/ConnectProgressBar.py index fe24728b..c9d59f5b 100644 --- a/Furious/Widget/ConnectProgressBar.py +++ b/Furious/Widget/ConnectProgressBar.py @@ -32,6 +32,9 @@ class ConnectProgressBar(QTranslatable, SupportConnectedCallback, QWidget): self.setWindowTitle(_(APPLICATION_NAME)) self.setWindowIcon(AppHue.currentWindowIcon()) + self.setAttribute(QtCore.Qt.WidgetAttribute.WA_ShowWithoutActivating) + self.setWindowFlags(QtCore.Qt.WindowType.WindowStaysOnTopHint) + self.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus) self.setFixedSize(280, 61) @QtCore.Slot() diff --git a/Furious/Window/AppMainWindow.py b/Furious/Window/AppMainWindow.py index af220081..00345e12 100644 --- a/Furious/Window/AppMainWindow.py +++ b/Furious/Window/AppMainWindow.py @@ -158,13 +158,13 @@ class AppMainWindow(AppQMainWindow): super().__init__(*args, **kwargs) self.setWindowTitle(_(APPLICATION_NAME)) + self.setAttribute(QtCore.Qt.WidgetAttribute.WA_ShowWithoutActivating) self.updatesManager = UpdatesManager() self.networkStateManager = AppNetworkStateManager(parent=self) self.userServersQTableWidget = UserServersQTableWidget(parent=self) self.userSubsWindow = UserSubsWindow( - parent=self, deleteUniqueCallback=lambda unique: self.userServersQTableWidget.deleteItemByIndex( list( index