Files
picoclaw/web/backend/systray_stub_nocgo.go
T
wenjie a10036a7f1 refactor(web): clean up systray platform build files
Separate embedded tray icons into platform-specific files, rename the
no-cgo systray stub for consistency, and add the app version to the
launcher startup log.
2026-03-25 11:44:57 +08:00

35 lines
690 B
Go

//go:build (darwin || freebsd) && !cgo
package main
import (
"context"
"os"
"os/signal"
"runtime"
"syscall"
"time"
"github.com/sipeed/picoclaw/pkg/logger"
)
// runTray falls back to a headless mode on platforms where systray requires cgo.
func runTray() {
logger.Infof("System tray is unavailable in %s builds without cgo; running without tray", runtime.GOOS)
if !*noBrowser {
go func() {
time.Sleep(browserDelay)
if err := openBrowser(); err != nil {
logger.Errorf("Warning: Failed to auto-open browser: %v", err)
}
}()
}
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
<-ctx.Done()
shutdownApp()
}