Repository navigation
fix(tray): register the tray icon again when the panel forgets it - #125
Merged
Merged
Conversation
Cinnamon's xapp-sn-watcher before linuxmint/xapp#211 removes every status notifier item whose key starts with the bus name of a client that exits, so when ":1.51" quits, ":1.519/StatusNotifierItem" goes too. Qt registers its item once and again only when the watcher restarts, so the icon stayed off the panel while Whatly ran. Every 30 seconds, find the private connection Qt serves the item on and, if the watcher's RegisteredStatusNotifierItems lacks it, call RegisterStatusNotifierItem again. Linux only; does nothing when the icon is hidden or there is no watcher.
gbmaizol
force-pushed
the
fix/tray-reregister
branch
from
October 19, 2026 12:06
99534e8 to
ac32930
Compare
shakaran
approved these changes
Oct 21, 2026
shakaran
left a comment
Owner
There was a problem hiding this comment.
Thanks. Checked against Qt's qdbusmenuconnection.cpp: it registers the item with the connection's baseService(), so comparing against that is right. I pushed b8abbe4 to move your function above the menu-state comment, which had ended up documenting it instead of checkWindowState().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Linux Mint (Cinnamon) the tray icon can disappear from the panel while Whatly keeps running. When the window is hidden, that also takes away the only way back to it, or to Quit.
Cause. The icon is still served. Qt's StatusNotifierItem was alive on its own bus connection, answering with the right tooltip and unread count, but it was missing from the watcher's
RegisteredStatusNotifierItems. Cinnamon'sxapp-sn-watcherremoves items inhandle_sn_item_name_owner_lostwithg_str_has_prefix (key, name), so when a client named:1.51exits, the item registered as:1.519/StatusNotifierItemis removed with it. That is fixed upstream in linuxmint/xapp#211 (2026-09-04), but the xapp 3.2.3 Mint ships today still callsg_str_has_prefixthere, so it will be around for a while. CallingRegisterStatusNotifierItemfor the live item by hand brought the icon straight back.Qt registers its item once, and again only when the watcher service itself restarts (
QDBusTrayIcon::watcherServiceRegistered), so nothing in Qt notices.What this does. On Linux, every 30 seconds Whatly reads the watcher's
RegisteredStatusNotifierItemsasynchronously, and if its own item is not listed it callsRegisterStatusNotifierItemagain. Qt serves the item on a private connection namedorg.kde.StatusNotifierItem-<pid>-<n>, wherenalso counts the throwaway tray objectsisSystemTrayAvailable()creates. So the check does not guessn: it takes the connection that has an object at/StatusNotifierItem. If the icon is hidden, Qt has no such connection, or there is no watcher, it does nothing.Tested against a stand-in watcher on a private session bus, which drops every item 15 seconds after the first registration. Whatly registered at 1.9s, the watcher dropped it at 16.9s, and Whatly registered it again at 31.4s. Also running on the Flatpak build on Cinnamon, where the icon is present with the unread count.
@coderabbitai ignore