Merge branch 'main' into refactor/web-darwin-no-cgo
This commit is contained in:
commit
1f2d473155
1 changed files with 32 additions and 0 deletions
32
web/backend/tray_stub_darwin_nocgo.go
Normal file
32
web/backend/tray_stub_darwin_nocgo.go
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
//go:build darwin && !cgo
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"os"
|
||||||
|
"os/signal"
|
||||||
|
"syscall"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/sipeed/picoclaw/pkg/logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
func runTray() {
|
||||||
|
logger.Infof("System tray is unavailable in darwin builds without cgo; running without tray")
|
||||||
|
|
||||||
|
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()
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue