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.
This commit is contained in:
parent
3b3062abe8
commit
a10036a7f1
6 changed files with 19 additions and 16 deletions
|
|
@ -98,7 +98,7 @@ func main() {
|
|||
defer logger.DisableFileLogging()
|
||||
}
|
||||
|
||||
logger.InfoC("web", "PicoClaw Launcher starting...")
|
||||
logger.InfoC("web", fmt.Sprintf("%s Launcher %s starting...", appName, appVersion))
|
||||
logger.InfoC("web", fmt.Sprintf("PicoClaw Home: %s", picoHome))
|
||||
|
||||
// Set language from command line or auto-detect
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
|
||||
"fyne.io/systray"
|
||||
|
|
@ -93,8 +92,3 @@ func onReady() {
|
|||
func onExit() {
|
||||
logger.Info(T(Exiting))
|
||||
}
|
||||
|
||||
// getIcon returns the system tray icon
|
||||
func getIcon() []byte {
|
||||
return iconData
|
||||
}
|
||||
|
|
|
|||
12
web/backend/systray_icon_nonwindows.go
Normal file
12
web/backend/systray_icon_nonwindows.go
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
//go:build !windows && ((!darwin && !freebsd) || cgo)
|
||||
|
||||
package main
|
||||
|
||||
import _ "embed"
|
||||
|
||||
//go:embed icon.png
|
||||
var iconPNG []byte
|
||||
|
||||
func getIcon() []byte {
|
||||
return iconPNG
|
||||
}
|
||||
|
|
@ -5,4 +5,8 @@ package main
|
|||
import _ "embed"
|
||||
|
||||
//go:embed icon.ico
|
||||
var iconData []byte
|
||||
var iconICO []byte
|
||||
|
||||
func getIcon() []byte {
|
||||
return iconICO
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ import (
|
|||
"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)
|
||||
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
//go:build !windows
|
||||
|
||||
package main
|
||||
|
||||
import _ "embed"
|
||||
|
||||
//go:embed icon.png
|
||||
var iconData []byte
|
||||
Loading…
Add table
Reference in a new issue