Merge pull request #1985 from wj-xiao/refactor/split-systray
refactor(web): split systray platform build files
This commit is contained in:
commit
aa9bd69f6e
6 changed files with 19 additions and 16 deletions
|
|
@ -98,7 +98,7 @@ func main() {
|
||||||
defer logger.DisableFileLogging()
|
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))
|
logger.InfoC("web", fmt.Sprintf("PicoClaw Home: %s", picoHome))
|
||||||
|
|
||||||
// Set language from command line or auto-detect
|
// Set language from command line or auto-detect
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"fyne.io/systray"
|
"fyne.io/systray"
|
||||||
|
|
@ -93,8 +92,3 @@ func onReady() {
|
||||||
func onExit() {
|
func onExit() {
|
||||||
logger.Info(T(Exiting))
|
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"
|
import _ "embed"
|
||||||
|
|
||||||
//go:embed icon.ico
|
//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"
|
"github.com/sipeed/picoclaw/pkg/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// runTray falls back to a headless mode on platforms where systray requires cgo.
|
||||||
func runTray() {
|
func runTray() {
|
||||||
logger.Infof("System tray is unavailable in %s builds without cgo; running without tray", runtime.GOOS)
|
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