Skip to content

fix: StatusNotifierItemService: Re-register when watcher reappears

stalent requested to merge stalent/gajim:fix/tray-icon-watcher-reregister into master

Noticed the tray icon disappears from my status bar (Waybar, on Hyprland) every time the bar itself gets restarted, while other tray apps (NetworkManager applet, Blueman) keep showing up fine after the restart.

Turned out Waybar hosts its own org.kde.StatusNotifierWatcher internally, so when it restarts the watcher's bus name goes away and comes back with an empty item list. Gajim currently only calls RegisterStatusNotifierItem once, right when the tray icon is first created, so it never finds out the watcher is back and never re-registers. The other apps use libayatana-appindicator under the hood, which watches the name and re-registers automatically - that's why they don't have this problem.

This patch does the same thing: instead of grabbing a one-shot DBusProxy, it watches and re-sends RegisterStatusNotifierItem every time it appears (first launch included). Tested by killing/restarting Waybar a few times with Gajim running - icon now comes back on its own instead of needing a Gajim restart.

Merge request reports

Loading