diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -378,11 +378,15 @@ window->setWalletController(m_wallet_controller); #endif - // If -min option passed, start window minimized. - if (gArgs.GetBoolArg("-min", false)) { - window->showMinimized(); - } else { + // If -min option passed, start window minimized(iconified) + // or minimized to tray + if (!gArgs.GetBoolArg("-min", false)) { window->show(); + } else if (clientModel->getOptionsModel()->getMinimizeToTray() && + window->hasTrayIcon()) { + // do nothing as the window is managed by the tray icon + } else { + window->showMinimized(); } Q_EMIT splashFinished(); Q_EMIT windowShown(window); diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -97,6 +97,12 @@ /** Disconnect core signals from GUI client */ void unsubscribeFromCoreSignals(); + /** + * Get the tray icon status. + * Some systems have not "system tray" or "notification area" available. + */ + bool hasTrayIcon() const { return trayIcon; } + protected: void changeEvent(QEvent *e) override; void closeEvent(QCloseEvent *event) override;