dequoter/main.go

71 lines
1.5 KiB
Go
Raw Normal View History

package main
import (
"embed"
2026-01-25 22:31:14 +00:00
"log"
"runtime"
rt "github.com/wailsapp/wails/v2/pkg/runtime"
"github.com/wailsapp/wails/v2"
2026-01-25 22:31:14 +00:00
"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"
2026-01-25 22:31:14 +00:00
"github.com/wailsapp/wails/v2/pkg/options/mac"
)
//go:embed all:frontend/dist
var assets embed.FS
func main() {
2026-01-25 22:31:14 +00:00
store, err := NewStore()
if err != nil {
log.Fatal(err)
}
// Create an instance of the app structure
2026-01-25 22:31:14 +00:00
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
2026-01-25 22:31:14 +00:00
err = wails.Run(&options.App{
2025-09-06 01:26:54 +00:00
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,
},
2026-01-25 22:31:14 +00:00
Menu: appMenu,
Mac: &mac.Options{
About: &mac.AboutInfo{
Title: "Dequoter",
Message: "© 2025 Leon Mika",
},
},
})
if err != nil {
println("Error:", err.Error())
}
}