-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.go
70 lines (60 loc) · 1.81 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package main
import (
"embed"
"flag"
"github.com/Notifiarr/toolbarr/pkg/app"
logs "github.com/Notifiarr/toolbarr/pkg/logs"
"github.com/Notifiarr/toolbarr/pkg/mnd"
"github.com/Notifiarr/toolbarr/pkg/starrs"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/logger"
"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"
)
//go:embed all:frontend/dist
var assets embed.FS
//nolint:gomnd
func main() {
// Create an instance of the app structure
log := logs.New()
defer log.CapturePanic()
var configFile string
flag.StringVar(&configFile, "c", "", "Config file path. Determined automatically if not provided.")
flag.Parse()
appMenu := menu.NewMenu()
fileMenu := appMenu.AddSubmenu("File")
appMenu.Append(menu.EditMenu())
app := app.New(log, &app.Config{
Logger: log,
ConfigFile: configFile,
AppMenu: appMenu,
Starrs: &starrs.Starrs{},
})
if mnd.IsWindows {
fileMenu.AddText("Exit", keys.OptionOrAlt("f4"), func(_ *menu.CallbackData) { app.Quit() })
} else {
fileMenu.AddText("Quit", keys.CmdOrCtrl("q"), func(_ *menu.CallbackData) { app.Quit() })
}
// Create application with options
err := wails.Run(&options.App{
Title: mnd.Title,
Width: 1024,
Height: 720,
MinWidth: 480,
MinHeight: 600,
MaxWidth: 1500,
Fullscreen: false,
AssetServer: &assetserver.Options{Assets: assets},
OnStartup: app.Startup,
Menu: appMenu,
Bind: []interface{}{app, app.Starrs},
Logger: log.Wails,
LogLevel: logger.DEBUG,
LogLevelProduction: logger.INFO,
})
if err != nil {
panic("Error: " + err.Error())
}
}