From a9f8f9d55277598636b680fd952755c5ecb46b8b Mon Sep 17 00:00:00 2001
From: Ruben Pollan <meskio@sindominio.net>
Date: Fri, 26 Mar 2021 17:53:57 +0100
Subject: [PATCH] Toggle app window visibility clicking on the systray icon

---
 gui/qml/main.qml | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/gui/qml/main.qml b/gui/qml/main.qml
index ddd049d7..a29c8d18 100644
--- a/gui/qml/main.qml
+++ b/gui/qml/main.qml
@@ -320,10 +320,15 @@ Window {
 
         id: systray
         visible: systrayVisible
-        signal activatedSignal
 
         onActivated: {
-            systray.activatedSignal()
+	    if (reason != SystemTrayIcon.Context) {
+		if (app.visible) {
+		    app.hide()
+		} else {
+		    app.show()
+		}
+            }
         }
 
 
@@ -336,16 +341,6 @@ Window {
 
             id: systrayMenu
 
-            Connections {
-                target: systray
-                onActivatedSignal: {
-                    if (Qt.platform.os === "windows" || desktop === "LXQt") {
-                        console.debug("open systray menu")
-                        systrayMenu.open()
-                    }
-                }
-            }
-
             MenuItem {
                 id: statusItem
                 text: qsTr("Checking status…")
-- 
GitLab