Skip to content

Fix tray icon not displayed with GTK-based pystray backends on Linux - #1097

Open
d-tatianin wants to merge 1 commit into
mathoudebine:mainfrom
d-tatianin:fix/linux-tray-icon-glib-mainloop
Open

d-tatianin wants to merge 1 commit into
mathoudebine:mainfrom
d-tatianin:fix/linux-tray-icon-glib-mainloop

Conversation

@d-tatianin

Copy link
Copy Markdown

No description provided.

On Linux, when PyGObject is available, pystray uses its appindicator or gtk
backend. With these backends, run_detached() does not display anything by
itself: it only schedules the icon creation on the GLib main loop, and expects
the application to run that loop. The main loop was never started, so the icon
was never displayed and its menu never worked, while the log still reported
"Tray icon has been displayed".

Without PyGObject, pystray falls back to its xorg backend, which runs its own
loop but relies on XEmbed: on Wayland sessions (e.g. KDE Plasma) the icon is
shown as a blank square that barely responds to clicks.

Start the GLib main loop in a daemon thread when a GTK-based backend is used.
Other backends (xorg, win32, darwin) are unchanged.

Tested on Fedora 44 with KDE Plasma (Wayland), Python 3.14, pystray 0.19.5.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant