Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions plugins/Trayicon/TrayiconPlugin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sys
import atexit
import time

from Plugin import PluginManager
from Config import config
Expand Down Expand Up @@ -206,6 +207,23 @@ def hideIcon():
# Run pystray in a real OS thread (pystray is not gevent compatible)
self._icon_thread = threading.Thread(target=self.icon.run, name="Trayicon", daemon=True)
self._icon_thread.start()

# Periodically rebuild the menu so dynamic labels (IP, connections,
# transfer) reflect the current server state. The menu is built once
# by pystray at startup — before the file_server exists — so without
# this the labels stay frozen at their initial "no data" values.
def _menu_refresh_loop():
while self._icon_thread.is_alive():
time.sleep(5)
try:
self.icon.update_menu()
except Exception:
pass
self._menu_refresh_thread = threading.Thread(
target=_menu_refresh_loop, name="TrayiconMenuRefresh", daemon=True
)
self._menu_refresh_thread.start()

super(ActionsPlugin, self).main()
try:
self.icon.stop()
Expand Down
Loading