Skip to content

Show a working tray icon on Wayland (AppIndicator/SNI, Linux only) - #31

Open
mtb-xt wants to merge 1 commit into
Flairmesh:masterfrom
mtb-xt:wayland-sni-tray
Open

Show a working tray icon on Wayland (AppIndicator/SNI, Linux only)#31
mtb-xt wants to merge 1 commit into
Flairmesh:masterfrom
mtb-xt:wayland-sni-tray

Conversation

@mtb-xt

@mtb-xt mtb-xt commented Jul 27, 2026

Copy link
Copy Markdown

Fixes #30.

wx.adv.TaskBarIcon is backed by GtkStatusIcon (the old X11 _NET_SYSTEM_TRAY protocol), which does nothing on a Wayland session. On GNOME/KDE Wayland the tray icon just never appears, so "Minimize to System Tray" hides the window with no way to get it back.

This adds a small FlooCastTrayIcon that uses pystray's AppIndicator backend — it speaks the StatusNotifierItem D-Bus protocol that current shells actually render. It reuses the GLib main loop wx already runs (run_detached()), so there's no second event loop; menu clicks just come back through wx.CallAfter.

I was careful not to touch the platforms where the current tray already works:

  • make_tray_icon() only picks the new tray on Linux. Windows and macOS keep wx.adv.TaskBarIcon exactly as-is.
  • If pystray or the AppIndicator/Ayatana typelib isn't installed, it falls back to the wx tray and prints a note, so the app still starts.

The new class exposes the same restore_window() / Destroy() surface as the existing one, so it's a drop-in at the single construction site.

I've been running this on KDE Plasma (Wayland) — the icon shows up and the menu (Show / Minimize / Quit) restores the window reliably.

Extra dependency on Linux only: pystray, plus the AppIndicator3 (or AyatanaAppIndicator3) GI typelib. Happy to adjust naming, the fallback message, or anything else to fit how you'd like it. Thanks!

wx.adv.TaskBarIcon is backed by GtkStatusIcon, which is invisible on
Wayland sessions (GNOME, KDE). That makes 'Minimize to System Tray' a
one-way trip. Add a pystray/AppIndicator tray that speaks the
StatusNotifierItem protocol modern shells render, and select it only on
Linux via make_tray_icon() -- Windows and macOS keep the native wx tray
untouched, with a fallback to it if pystray isn't available.
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.

Tray icon invisible on Wayland (GtkStatusIcon); AppIndicator/SNI fix works

1 participant