mirror of
https://github.com/Macrame-App/Macrame
synced 2025-12-29 07:19:26 +00:00
Systray update, build script update.
This commit is contained in:
parent
9c6b20ecc6
commit
d1de67910d
2 changed files with 10 additions and 8 deletions
|
|
@ -14,14 +14,14 @@ func InitSystray() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func OnReady() {
|
func OnReady() {
|
||||||
systray.SetIcon(getFavicon())
|
systray.SetIcon(getIcon("favicon.ico"))
|
||||||
systray.SetTitle("Macrame")
|
systray.SetTitle("Macrame")
|
||||||
systray.SetTooltip("Macrame - Server")
|
systray.SetTooltip("Macrame - Server")
|
||||||
|
|
||||||
ip, err := GetServerIp()
|
ip, err := GetServerIp()
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
systray.AddMenuItem("IP: "+ip+":"+helper.EnvGet("MCRM__PORT"), "")
|
systray.AddMenuItem("IP: "+ip+":"+helper.EnvGet("MCRM__PORT"), "Server IP")
|
||||||
}
|
}
|
||||||
|
|
||||||
systray.AddSeparator()
|
systray.AddSeparator()
|
||||||
|
|
@ -42,6 +42,7 @@ func OnReady() {
|
||||||
|
|
||||||
func addMCRMItem(name, urlPath string) {
|
func addMCRMItem(name, urlPath string) {
|
||||||
m := systray.AddMenuItem(name, name)
|
m := systray.AddMenuItem(name, name)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
<-m.ClickedCh
|
<-m.ClickedCh
|
||||||
helper.OpenBrowser("http://localhost:" + helper.EnvGet("MCRM__PORT") + urlPath)
|
helper.OpenBrowser("http://localhost:" + helper.EnvGet("MCRM__PORT") + urlPath)
|
||||||
|
|
@ -52,12 +53,12 @@ func OnExit() {
|
||||||
systray.Quit()
|
systray.Quit()
|
||||||
}
|
}
|
||||||
|
|
||||||
func getFavicon() []byte {
|
func getIcon(path string) []byte {
|
||||||
favicon, err := os.ReadFile("favicon.ico")
|
icon, err := os.ReadFile(path)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
MCRMLog("getFavicon Error: ", err)
|
MCRMLog("getIcon Error: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return favicon
|
return icon
|
||||||
}
|
}
|
||||||
|
|
|
||||||
5
build.sh
5
build.sh
|
|
@ -5,7 +5,7 @@ BUILD_DIR="Macrame_$(date +'%m%d%H%M%S')"
|
||||||
|
|
||||||
# Build the Go application
|
# Build the Go application
|
||||||
cd be
|
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 -ldflags "-H=windowsgui" -o Macrame.exe main.go
|
||||||
go build -o Setup.exe setup/setup.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
|
# Move the generated files to the new build directory
|
||||||
cp ../be/Macrame.exe $BUILD_DIR/be/Macrame.exe
|
cp ../be/Macrame.exe $BUILD_DIR/be/Macrame.exe
|
||||||
cp ../be/Setup.exe $BUILD_DIR/be/Setup.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 ../macros/* $BUILD_DIR/macros/
|
||||||
cp -r ../panels/* $BUILD_DIR/panels/
|
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 ../install.bat $BUILD_DIR/install.bat
|
||||||
cp ../Macrame.lnk $BUILD_DIR/Macrame.lnk
|
cp ../Macrame.lnk $BUILD_DIR/Macrame.lnk
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue