From 76fcfa9ed368234138552c931c9b0e671d3481a3 Mon Sep 17 00:00:00 2001 From: Richard Stanway Date: Sun, 27 Sep 2020 19:19:15 +0200 Subject: [PATCH] UI: Clarify system tray code If the tray is disabled in settings, we no longer allow the command line parameter to override it and create a tray icon regardless. This matches the behavior in the UI, where "minimize to tray on startup" becomes unavailable if the "tray enabled" setting is unselected. --- UI/window-basic-main.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index eb52705a2..a93b21363 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -7592,12 +7592,11 @@ void OBSBasic::SystemTray(bool firstStarted) if (firstStarted) SystemTrayInit(); - if (!sysTrayWhenStarted && !sysTrayEnabled) { + if (!sysTrayEnabled) { trayIcon->hide(); - } else if ((sysTrayWhenStarted && sysTrayEnabled) || - opt_minimize_tray) { + } else { trayIcon->show(); - if (firstStarted) { + if (firstStarted && (sysTrayWhenStarted || opt_minimize_tray)) { QTimer::singleShot(50, this, SLOT(hide())); EnablePreviewDisplay(false); setVisible(false); @@ -7606,12 +7605,6 @@ void OBSBasic::SystemTray(bool firstStarted) #endif opt_minimize_tray = false; } - } else if (sysTrayEnabled) { - trayIcon->show(); - } else if (!sysTrayEnabled) { - trayIcon->hide(); - } else if (!sysTrayWhenStarted && sysTrayEnabled) { - trayIcon->hide(); } if (isVisible())