fix: add TrayRecoveryService with bidirectional SNI dedup (Go server)#2137
Open
Dimariqe wants to merge 3 commits intoAvengeMedia:masterfrom
Open
fix: add TrayRecoveryService with bidirectional SNI dedup (Go server)#2137Dimariqe wants to merge 3 commits intoAvengeMedia:masterfrom
Dimariqe wants to merge 3 commits intoAvengeMedia:masterfrom
Conversation
Add TrayRecoveryService manager that re-registers lost tray icons after resume from suspend via native DBus scanning in the Go server. The service resolves every registered SNI item (both well-known names and :1.xxx connection IDs) to a canonical connection ID, building a unified registeredConnIDs set before either scan section runs. This prevents duplicates in both directions: - If an app registered via well-known name, the connection-ID section skips its :1.xxx entry. - If an app registered via connection ID, the well-known-name section skips its well-known name (checked through registeredConnIDs). - After successfully registering via well-known name, registeredConnIDs is updated immediately so the connection-ID section won't probe the same app in the same run. A startup scan (3 s delay) covers the common case where the DMS process is killed during suspend and restarted by systemd (Type=dbus), so the loginctl PrepareForSleep watcher alone is not sufficient. The startup scan is harmless on a normal boot — it finds all items already registered and exits early. Go port of quickshell commit 1470aa3.
bbedward
requested changes
Apr 3, 2026
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.
Go server: add TrayRecoveryService with bidirectional SNI dedup
Go-side implementation of the TrayRecoveryService introduced in #2117.
What
New
trayrecoverypackage (core/internal/server/trayrecovery/) thatre-registers lost system tray icons after resume from suspend using
native DBus calls (
godbus/dbus/v5) instead of shelling out to bash.How it works
PrepareForSleep true→falsetransition from loginctl, the service scans the session bus for
unregistered SNI items.
:1.xxx) is resolved to acanonical connection ID, building a unified
registeredConnIDsset.This prevents duplicates in both directions — same logic as the QML
version from fix: tray icons duplicating and disappearing after session restore #2117.
at
/StatusNotifierItemand/org/ayatana/NotificationItem/$SHORTwith a 300 ms timeout.
(batches of 30, 150 ms timeout) with case-insensitive SNI Id dedup.
org.kde.StatusNotifierWatcher.RegisterStatusNotifierItem.Why startup scan is needed
The DMS systemd unit is
Type=dbuswithBusName=org.freedesktop.Notifications. During suspend the bus name canbriefly disappear, causing systemd to kill and restart the process. The
fresh process never sees the
PrepareForSleep true→falsetransition, sothe loginctl watcher alone is not enough. The startup scan covers this
case and is harmless on a normal boot — it finds all items already
registered and exits early.
Files changed
core/internal/server/trayrecovery/manager.gocore/internal/server/trayrecovery/recovery.gocore/internal/server/server.go