-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
56 lines (48 loc) · 1.18 KB
/
Copy pathmain.go
File metadata and controls
56 lines (48 loc) · 1.18 KB
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
package main
import (
"embed"
"log"
"github.com/wailsapp/wails/v3/pkg/application"
)
//go:embed all:frontend/dist
var assets embed.FS
func init() {
application.RegisterEvent[ExecutionEvent]("execution:log")
}
func main() {
service, err := NewLauncherService()
if err != nil {
log.Fatal(err)
}
defer service.close()
app := application.New(application.Options{
Name: "Script Launcher",
Description: "统一管理和执行本地脚本、程序及常用命令",
Services: []application.Service{
application.NewService(service),
},
Assets: application.AssetOptions{
Handler: application.AssetFileServerFS(assets),
},
Mac: application.MacOptions{
ApplicationShouldTerminateAfterLastWindowClosed: true,
},
})
service.setApp(app)
app.Window.NewWithOptions(application.WebviewWindowOptions{
Title: "Script Launcher",
Width: 1180,
Height: 760,
MinWidth: 860,
MinHeight: 560,
Mac: application.MacWindow{
InvisibleTitleBarHeight: 50,
TitleBar: application.MacTitleBarHiddenInset,
},
BackgroundColour: application.NewRGB(246, 247, 249),
URL: "/",
})
if err := app.Run(); err != nil {
log.Fatal(err)
}
}