Skip to content

Commit 0ed279c

Browse files
committed
Merge #14517: qt: Fix start with the -min option
9300961 Fix start with the `-min` option (Hennadii Stepanov) Pull request description: From IRC: > 2018-10-17T12:36:38 \<Drakon\> The option to minimize to system tray instead of the taskbar ist available, but doesn't have an effect if it is started with the -min option. If I start it via that option, I have to click on the program symbil on the taskbar and then minimize it again in order to get it minimized to system tray. > 2018-10-17T12:37:28 \<Drakon\> That's annoying. > 2018-10-17T13:51:19 \<wumpus\> can you open an issue for that please? https://github.com/bitcoin/bitcoin/issues/new > 2018-10-17T13:53:24 \<wumpus\> (if there isn't one yet-) This PR fixes this bug. Tree-SHA512: c5a5521287b49b13859edc7c6bd1cd07cac14b84740450181dce00bf2781fc3dfc84476794baa16b0e26a2d004164617afdb61f829e629569703c5bcc45e2a4e
2 parents c7fab55 + 9300961 commit 0ed279c

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
@@ -392,14 +392,13 @@ void BitcoinApplication::initializeResult(bool success)
392392
}
393393
#endif
394394

395-
// If -min option passed, start window minimized.
396-
if(gArgs.GetBoolArg("-min", false))
397-
{
398-
window->showMinimized();
399-
}
400-
else
401-
{
395+
// If -min option passed, start window minimized (iconified) or minimized to tray
396+
if (!gArgs.GetBoolArg("-min", false)) {
402397
window->show();
398+
} else if (clientModel->getOptionsModel()->getMinimizeToTray() && window->hasTrayIcon()) {
399+
// do nothing as the window is managed by the tray icon
400+
} else {
401+
window->showMinimized();
403402
}
404403
Q_EMIT splashFinished();
405404
Q_EMIT windowShown(window);

src/qt/bitcoingui.h

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

89+
/** Get the tray icon status.
90+
Some systems have not "system tray" or "notification area" available.
91+
*/
92+
bool hasTrayIcon() const { return trayIcon; }
93+
8994
protected:
9095
void changeEvent(QEvent *e);
9196
void closeEvent(QCloseEvent *event);

0 commit comments

Comments
 (0)