UPDATE: System tray setting

This commit is contained in:
2025-10-07 13:14:18 +07:00
parent a6b49bef24
commit edbe04b9fc
15 changed files with 682 additions and 477 deletions

12
main.go
View File

@@ -17,6 +17,7 @@ import (
"path/filepath"
"github.com/wailsapp/wails/v3/pkg/application"
"github.com/wailsapp/wails/v3/pkg/events"
)
//go:embed all:frontend/dist
@@ -84,7 +85,7 @@ func main() {
})
// Create window
app.Window.NewWithOptions(application.WebviewWindowOptions{
window := app.Window.NewWithOptions(application.WebviewWindowOptions{
Title: "Firefly Launcher - Kain",
Mac: application.MacWindow{
InvisibleTitleBarHeight: 50,
@@ -106,13 +107,20 @@ func main() {
// Attach the window to the system tray
menu := application.NewMenu()
menu.Add("Open").OnClick(func(ctx *application.Context) {
// Handle click
window.Show()
})
menu.Add("Quit").OnClick(func(ctx *application.Context) {
app.Quit()
})
systemTray.SetMenu(menu)
window.RegisterHook(events.Common.WindowClosing, func(e *application.WindowEvent) {
app.Event.Emit("window:close")
e.Cancel()
})
err = app.Run()
if err != nil {