Skip to content
Open
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
6 changes: 6 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ def on_win32_wm_event(hWnd, msg, wParam, lParam):
# For platforms != macOS, display the tray icon now with non-blocking function
if platform.system() != "Darwin":
tray_icon.run_detached()
# GTK-based backends (Linux) only schedule the icon on the GLib main loop: it must be running for the
# icon to appear and respond to clicks
if tray_icon.__module__ in ("pystray._appindicator", "pystray._gtk"):
import threading
from gi.repository import GLib
threading.Thread(target=GLib.MainLoop().run, daemon=True).start()
logger.info("Tray icon has been displayed")
except:
tray_icon = None
Expand Down