Skip to content

Commit 9300961

Browse files
committed
Fix start with the -min option
When GUI starts with the `-min` option, the `Minimize to tray instead of the taskbar` option works as expected now.
1 parent d387507 commit 9300961

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/qt/bitcoin.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -487,14 +487,13 @@ void BitcoinApplication::initializeResult(bool success)
487487
}
488488
#endif
489489

490-
// If -min option passed, start window minimized.
491-
if(gArgs.GetBoolArg("-min", false))
492-
{
493-
window->showMinimized();
494-
}
495-
else
496-
{
490+
// If -min option passed, start window minimized (iconified) or minimized to tray
491+
if (!gArgs.GetBoolArg("-min", false)) {
497492
window->show();
493+
} else if (clientModel->getOptionsModel()->getMinimizeToTray() && window->hasTrayIcon()) {
494+
// do nothing as the window is managed by the tray icon
495+
} else {
496+
window->showMinimized();
498497
}
499498
Q_EMIT splashFinished(window);
500499

src/qt/bitcoingui.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ class BitcoinGUI : public QMainWindow
8282
#endif // ENABLE_WALLET
8383
bool enableWallet = false;
8484

85+
/** Get the tray icon status.
86+
Some systems have not "system tray" or "notification area" available.
87+
*/
88+
bool hasTrayIcon() const { return trayIcon; }
89+
8590
protected:
8691
void changeEvent(QEvent *e);
8792
void closeEvent(QCloseEvent *event);

0 commit comments

Comments
 (0)