fix(desktop): harden topic ids and tray probing

This commit is contained in:
Sivan committed 2026-06-30 11:34:17 +08:00
1 parent c8ccc01740
commit c675d754cc
2 files changed
+6 -2

No files matched your search

+4 -1
View File
@@ -5156,7 +5156,10 @@ func newTabID() string {
func newTopicID() string {
var b [8]byte
rand.Read(b[:])
if _, err := rand.Read(b[:]); err != nil {
now := time.Now().UTC()
return "topic_" + now.Format("20060102-150405") + "_" + fmt.Sprintf("%09d", now.Nanosecond())
}
return "topic_" + time.Now().UTC().Format("20060102-150405") + "_" + hex.EncodeToString(b[:])
}
+2 -1
View File
@@ -9,7 +9,8 @@ func traySupported() bool {
if err != nil {
return false
}
defer conn.Close()
// SessionBus returns a shared singleton connection. Do not close it here:
// other desktop integrations in this process may still be using it.
obj := conn.Object("org.freedesktop.DBus", "/org/freedesktop/DBus")
var owner string
return obj.Call("org.freedesktop.DBus.GetNameOwner", 0, "org.kde.StatusNotifierWatcher").Store(&owner) == nil && owner != ""