This commit is contained in:
parent
1d0d3230c9
commit
f96b8a8266
9 changed files with 154 additions and 7 deletions
38
main.go
38
main.go
|
|
@ -2,21 +2,48 @@ 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()
|
||||
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{
|
||||
err = wails.Run(&options.App{
|
||||
Title: "Dequoter",
|
||||
Width: 800,
|
||||
Height: 600,
|
||||
|
|
@ -28,6 +55,13 @@ func main() {
|
|||
Bind: []interface{}{
|
||||
app,
|
||||
},
|
||||
Menu: appMenu,
|
||||
Mac: &mac.Options{
|
||||
About: &mac.AboutInfo{
|
||||
Title: "Dequoter",
|
||||
Message: "© 2025 Leon Mika",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue