From d1de67910d8aabd77c89e1ea3ef6937f4256eff3 Mon Sep 17 00:00:00 2001 From: Jesse Malotaux Date: Sat, 3 May 2025 14:59:31 +0200 Subject: [PATCH] Systray update, build script update. --- be/app/systray.go | 13 +++++++------ build.sh | 5 +++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/be/app/systray.go b/be/app/systray.go index fe36705..edd88e9 100644 --- a/be/app/systray.go +++ b/be/app/systray.go @@ -14,14 +14,14 @@ func InitSystray() { } func OnReady() { - systray.SetIcon(getFavicon()) + systray.SetIcon(getIcon("favicon.ico")) systray.SetTitle("Macrame") systray.SetTooltip("Macrame - Server") ip, err := GetServerIp() if err == nil { - systray.AddMenuItem("IP: "+ip+":"+helper.EnvGet("MCRM__PORT"), "") + systray.AddMenuItem("IP: "+ip+":"+helper.EnvGet("MCRM__PORT"), "Server IP") } systray.AddSeparator() @@ -42,6 +42,7 @@ func OnReady() { func addMCRMItem(name, urlPath string) { m := systray.AddMenuItem(name, name) + go func() { <-m.ClickedCh helper.OpenBrowser("http://localhost:" + helper.EnvGet("MCRM__PORT") + urlPath) @@ -52,12 +53,12 @@ func OnExit() { systray.Quit() } -func getFavicon() []byte { - favicon, err := os.ReadFile("favicon.ico") +func getIcon(path string) []byte { + icon, err := os.ReadFile(path) if err != nil { - MCRMLog("getFavicon Error: ", err) + MCRMLog("getIcon Error: ", err) } - return favicon + return icon } diff --git a/build.sh b/build.sh index 4e173d7..7f41375 100644 --- a/build.sh +++ b/build.sh @@ -5,7 +5,7 @@ BUILD_DIR="Macrame_$(date +'%m%d%H%M%S')" # Build the Go application cd be -# go build -o Macrame.exe main.go // old command before systray update +# go build -o Macrame.exe main.go go build -ldflags "-H=windowsgui" -o Macrame.exe main.go go build -o Setup.exe setup/setup.go @@ -25,9 +25,10 @@ mkdir $BUILD_DIR/public # Move the generated files to the new build directory cp ../be/Macrame.exe $BUILD_DIR/be/Macrame.exe cp ../be/Setup.exe $BUILD_DIR/be/Setup.exe +cp ../be/favicon.ico $BUILD_DIR/be/favicon.ico cp -r ../macros/* $BUILD_DIR/macros/ cp -r ../panels/* $BUILD_DIR/panels/ -cp -r ../public/* $BUILD_DIR/public/ +mv ../public/* $BUILD_DIR/public/ cp ../install.bat $BUILD_DIR/install.bat cp ../Macrame.lnk $BUILD_DIR/Macrame.lnk