-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
80 lines (68 loc) · 1.58 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
71
72
73
74
75
76
77
78
79
80
package main
import (
"embed"
"encoding/json"
"fmt"
"ivy-git/ivy"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
"github.com/wailsapp/wails/v2/pkg/options/linux"
"github.com/wailsapp/wails/v2/pkg/options/mac"
"github.com/wailsapp/wails/v2/pkg/options/windows"
)
//go:embed all:frontend/dist
var assets embed.FS
//go:embed build/appicon.png
var appIcon []byte
//go:embed wails.json
var wailsJson []byte
func main() {
// Create an instance of the app structure
app := ivy.NewApp()
// Add config from wails.json for context
app.WailsConfig = getWailsConfig()
// Create application with options
err := wails.Run(&options.App{
Title: "Ivy Git",
Width: 1280,
Height: 768,
MinWidth: 1024,
MinHeight: 600,
Frameless: true,
AssetServer: &assetserver.Options{
Assets: assets,
},
BackgroundColour: appBgColor(),
OnStartup: app.Startup,
OnDomReady: app.Domready,
Bind: []interface{}{
app,
},
Mac: &mac.Options{
WindowIsTranslucent: true,
WebviewIsTransparent: true,
},
Windows: &windows.Options{
WindowIsTranslucent: true,
WebviewIsTransparent: true,
},
Linux: &linux.Options{
Icon: appIcon,
WindowIsTranslucent: false,
},
Debug: options.Debug{
OpenInspectorOnStartup: true,
},
})
if err != nil {
println("Error (main)", err.Error())
}
}
func getWailsConfig() ivy.WailsConfig {
var cfg ivy.WailsConfig
if err := json.Unmarshal(wailsJson, &cfg); err != nil {
fmt.Println(err.Error())
}
return cfg
}