返回 DeepSeek-Reasonix
tray_nocgo.go
根目录 / desktop / tray_nocgo.go
1 //go:build !windows && !cgo
2
3 package main
4
5 import "sync"
6
7 // desktopTray remains part of App's shape in pure-Go builds, but native tray
8 // implementations require platform UI libraries. Desktop startup already
9 // treats a missing tray as an optional capability.
10 type desktopTray struct {
11 ready chan struct{}
12 readyOnce sync.Once
13 }
14
15 func newDesktopTray() *desktopTray { return &desktopTray{ready: make(chan struct{})} }
16
17 func (t *desktopTray) markReady() { t.readyOnce.Do(func() { close(t.ready) }) }
18
19 func (a *App) startTray() bool {
20 if a == nil || a.shuttingDown.Load() || a.forceQuit.Load() {
21 return false
22 }
23 if a.hostShell != nil {
24 return a.hostShell.startTray()
25 }
26 a.setTrayHealth(nil, "unavailable", "native_tray_unavailable")
27 return false
28 }
29
30 func (a *App) stopTray() {
31 if a != nil && a.hostShell != nil {
32 a.hostShell.stopTray()
33 }
34 }
35
36 func (a *App) updateTrayLocale(locale string) {
37 if a != nil && a.hostShell != nil {
38 a.hostShell.updateTrayLocale(locale)
39 }
40 }
41
41 lines GO