Skip to content

Commit 26580fe

Browse files
committed
Open Dashboard on double click
1 parent 19f8719 commit 26580fe

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

aw_qt/trayicon.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,25 @@ def __init__(
8787
self.manager = manager
8888
self.testing = testing
8989

90+
self.root_url = "http://localhost:{port}".format(port=5666 if self.testing else 5600)
91+
self.activated.connect(self.on_activated)
92+
9093
self._build_rootmenu()
9194

95+
def on_activated(self, reason: QSystemTrayIcon.ActivationReason):
96+
if reason == QSystemTrayIcon.DoubleClick:
97+
open_webui(self.root_url)
98+
9299
def _build_rootmenu(self) -> None:
93100
menu = QMenu(self._parent)
94101

95-
root_url = "http://localhost:{port}".format(port=5666 if self.testing else 5600)
96-
97102
if self.testing:
98103
menu.addAction("Running in testing mode") # .setEnabled(False)
99104
menu.addSeparator()
100105

101106
# openWebUIIcon = QIcon.fromTheme("open")
102-
menu.addAction("Open Dashboard", lambda: open_webui(root_url))
103-
menu.addAction("Open API Browser", lambda: open_apibrowser(root_url))
107+
menu.addAction("Open Dashboard", lambda: open_webui(self.root_url))
108+
menu.addAction("Open API Browser", lambda: open_apibrowser(self.root_url))
104109

105110
menu.addSeparator()
106111

0 commit comments

Comments
 (0)