-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
58 lines (50 loc) · 1.54 KB
/
main.go
File metadata and controls
58 lines (50 loc) · 1.54 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
57
58
// Copyright 2025 Asher Buk
// SPDX-License-Identifier: Apache-2.0
// https://github.com/AshBuk/FingerGo
package main
import (
"context"
"embed"
"log"
"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/mac"
"github.com/wailsapp/wails/v2/pkg/options/windows"
"github.com/AshBuk/FingerGo/app"
)
//go:embed gui/src
var assets embed.FS
func main() {
appInstance := app.New()
if err := wails.Run(&options.App{
Title: "FingerGo",
Width: 1100,
Height: 700,
MinWidth: 800,
MinHeight: 600,
AssetServer: &assetserver.Options{Assets: assets},
OnStartup: wrapStartup(appInstance),
OnShutdown: appInstance.Shutdown,
Bind: []interface{}{appInstance},
Frameless: false,
EnableDefaultContextMenu: true,
Windows: &windows.Options{
Theme: windows.Dark,
},
Mac: &mac.Options{
Appearance: mac.NSAppearanceNameDarkAqua,
},
}); err != nil {
log.Fatalf("failed to start application: %v", err)
}
}
// wrapStartup wraps App.Startup to handle errors properly.
// Wails expects OnStartup callback to not return error, so we handle it here.
func wrapStartup(appInstance *app.App) func(ctx context.Context) {
return func(ctx context.Context) {
if err := appInstance.Startup(ctx); err != nil {
log.Fatalf("application startup failed: %v", err)
}
}
}