返回 DeepSeek-Reasonix
tray_supported_unix.go
根目录 / desktop / tray_supported_unix.go
1 //go:build !windows && !darwin
2
3 package main
4
5 import "github.com/godbus/dbus/v5"
6
7 func traySupported() bool {
8 conn, err := dbus.SessionBus()
9 if err != nil {
10 return false
11 }
12 // SessionBus returns a shared singleton connection. Do not close it here:
13 // other desktop integrations in this process may still be using it.
14 obj := conn.Object("org.freedesktop.DBus", "/org/freedesktop/DBus")
15 var owner string
16 return obj.Call("org.freedesktop.DBus.GetNameOwner", 0, "org.kde.StatusNotifierWatcher").Store(&owner) == nil && owner != ""
17 }
18
18 lines GO