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:
parent
a6f75775ed
commit
78ec74a72c
1 changed files with 3 additions and 2 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue