1
0
Fork 0
mirror of https://github.com/borgbase/vorta synced 2025-02-20 13:26:54 +00:00

Fix tray menu on XFCE.

The menu is build ones before the tray icon is clicked so that it is registered correctly.

* src/vorta/tray_menu.py (TrayMenu): Rename `on_user_click` to `build_menu`.

* src/vorta/tray_menu.py (TrayMenu.__init__): Call `build_menu`.
This commit is contained in:
real-yfprojects 2023-01-21 11:44:27 +01:00
parent a6f75775ed
commit 78ec74a72c
No known key found for this signature in database
GPG key ID: 00F630DFDEE25747

View file

@ -13,9 +13,10 @@ def __init__(self, parent: QApplication = None):
menu = QMenu()
# Workaround to get `activated` signal on Unity: https://stackoverflow.com/a/43683895/3983708
menu.aboutToShow.connect(self.on_user_click)
menu.aboutToShow.connect(self.build_menu)
self.setContextMenu(menu)
self.build_menu()
self.activated.connect(self.on_activation)
self.app.paletteChanged.connect(lambda p: self.set_tray_icon())
@ -35,7 +36,7 @@ def on_activation(self, reason):
] and os.environ.get('XDG_CURRENT_DESKTOP'):
self.app.toggle_main_window_visibility()
def on_user_click(self):
def build_menu(self):
"""Build system tray menu based on current state."""
menu = self.contextMenu()