Skip to content

Commit

Permalink
fix: show context menu on left click, open app on double click
Browse files Browse the repository at this point in the history
Signed-off-by: Sylvain Leclerc <[email protected]>
  • Loading branch information
sylvlecl committed Sep 30, 2024
1 parent a643ac4 commit bb04028
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion antarest/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import httpx
import uvicorn
from PyQt5.QtGui import QIcon
from PyQt5.QtGui import QIcon, QCursor
from PyQt5.QtWidgets import QAction, QApplication, QMenu, QSystemTrayIcon

from antarest.core.utils.utils import get_local_path
Expand Down Expand Up @@ -88,7 +88,17 @@ def create_systray_app() -> AntaresSystrayApp:
quit_action.triggered.connect(app.quit)

# Adding options to the System Tray
def handle_action(reason: int) -> None:
"""
- shows context menu also on left click
- open browser on double click
"""
if reason == QSystemTrayIcon.Trigger:
tray.contextMenu().popup(QCursor.pos())
if reason == QSystemTrayIcon.DoubleClick:
open_app()
tray.setContextMenu(menu)
tray.activated.connect(handle_action)

tray.setVisible(True)

Expand Down

0 comments on commit bb04028

Please sign in to comment.