dequoter/main.go
Leon Mika f96b8a8266
All checks were successful
Build / build (push) Successful in 1m0s
Added a store
2026-01-26 09:31:14 +11:00

71 lines
1.5 KiB
Go

package main
import (
"embed"
"log"
"runtime"
rt "github.com/wailsapp/wails/v2/pkg/runtime"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/menu"
"github.com/wailsapp/wails/v2/pkg/menu/keys"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
"github.com/wailsapp/wails/v2/pkg/options/mac"
)
//go:embed all:frontend/dist
var assets embed.FS
func main() {
store, err := NewStore()
if err != nil {
log.Fatal(err)
}
// Create an instance of the app structure
app := NewApp(store)
appMenu := menu.NewMenu()
if runtime.GOOS == "darwin" {
appMenu.Append(menu.AppMenu()) // On macOS platform, this must be done right after `NewMenu()`
}
fileMenu := appMenu.AddSubmenu("File")
fileMenu.AddText("Quit", keys.CmdOrCtrl("q"), func(_ *menu.CallbackData) {
// `rt` is an alias of "github.com/wailsapp/wails/v2/pkg/runtime" to prevent collision with standard package
rt.Quit(app.ctx)
})
if runtime.GOOS == "darwin" {
appMenu.Append(menu.EditMenu())
appMenu.Append(menu.WindowMenu())
}
// Create application with options
err = wails.Run(&options.App{
Title: "Dequoter",
Width: 800,
Height: 600,
AssetServer: &assetserver.Options{
Assets: assets,
},
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
OnStartup: app.startup,
Bind: []interface{}{
app,
},
Menu: appMenu,
Mac: &mac.Options{
About: &mac.AboutInfo{
Title: "Dequoter",
Message: "© 2025 Leon Mika",
},
},
})
if err != nil {
println("Error:", err.Error())
}
}