From fc462e82df5d76c45cf71c9ecde5468f8aa26ce3 Mon Sep 17 00:00:00 2001 From: Anatoliy Zinovyev Date: Sat, 21 Nov 2015 20:51:43 -0500 Subject: [PATCH 1/3] Fix behavior when clicking on the tray icon --- src/widget/widget.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 5b568f404..166b7a927 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -738,31 +738,23 @@ void Widget::onIconClick(QSystemTrayIcon::ActivationReason reason) { case QSystemTrayIcon::Trigger: { - if (isHidden()) + if (isHidden() || isMinimized()) { - show(); - activateWindow(); if (wasMaximized) showMaximized(); else showNormal(); + + activateWindow(); } - else if (isMinimized()) + else if (!isActiveWindow()) { - forceShow(); activateWindow(); - if (wasMaximized) - showMaximized(); - else - showNormal(); } else { wasMaximized = isMaximized(); - if (Settings::getInstance().getMinimizeToTray()) - hide(); - else - showMinimized(); + hide(); } break; From 6bbca9341d87759398fd9d222ca3b837744f82b4 Mon Sep 17 00:00:00 2001 From: Anatoliy Zinovyev Date: Wed, 25 Nov 2015 12:11:31 -0500 Subject: [PATCH 2/3] Do not do anything when middle clicking on the tray --- src/widget/widget.cpp | 50 ++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 166b7a927..702e485a9 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -734,44 +734,30 @@ void Widget::confirmExecutableOpen(const QFileInfo &file) void Widget::onIconClick(QSystemTrayIcon::ActivationReason reason) { - switch (reason) + if (reason == QSystemTrayIcon::Trigger) { - case QSystemTrayIcon::Trigger: + if (isHidden() || isMinimized()) { - if (isHidden() || isMinimized()) - { - if (wasMaximized) - showMaximized(); - else - showNormal(); - - activateWindow(); - } - else if (!isActiveWindow()) - { - activateWindow(); - } + if (wasMaximized) + showMaximized(); else - { - wasMaximized = isMaximized(); - hide(); - } + showNormal(); - break; + activateWindow(); } - case QSystemTrayIcon::MiddleClick: + else if (!isActiveWindow()) + { + activateWindow(); + } + else + { wasMaximized = isMaximized(); - if (Settings::getInstance().getMinimizeToTray()) - hide(); - else - showMinimized(); - break; - case QSystemTrayIcon::Unknown: - if (isHidden()) - forceShow(); - break; - default: - break; + hide(); + } + } + else if (reason == QSystemTrayIcon::Unknown) + { + forceShow(); } } From f2e39a1d1b2b319970e4807419fe1958e54f353b Mon Sep 17 00:00:00 2001 From: Anatoliy Zinovyev Date: Wed, 25 Nov 2015 17:35:17 -0500 Subject: [PATCH 3/3] Fix tray behavior with unity backend --- src/widget/widget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 702e485a9..40240533a 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -757,7 +757,8 @@ void Widget::onIconClick(QSystemTrayIcon::ActivationReason reason) } else if (reason == QSystemTrayIcon::Unknown) { - forceShow(); + if (isHidden()) + forceShow(); } }