-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
76 lines (66 loc) · 1.59 KB
/
main.go
File metadata and controls
76 lines (66 loc) · 1.59 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package main
import (
"embed"
"flag"
"fmt"
"os"
"github.com/ad201/deephermes/app"
"github.com/ad201/deephermes/pkg/config"
"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/windows"
)
//go:embed all:frontend/dist
var assets embed.FS
func main() {
configPath := flag.String("config", "config.yaml", "Path to config file")
cliMode := flag.Bool("cli", false, "Run in CLI mode (no GUI)")
flag.Parse()
cfg, err := config.Load(*configPath)
if err != nil {
fmt.Fprintf(os.Stderr, "Error loading config: %v\n", err)
os.Exit(1)
}
if *cliMode {
runCLI(cfg)
return
}
// Desktop mode
desktopApp := app.NewApp(cfg)
err = wails.Run(&options.App{
Title: "DeepHermes",
Width: 1200,
Height: 800,
MinWidth: 900,
MinHeight: 600,
Frameless: true,
AssetServer: &assetserver.Options{
Assets: assets,
},
OnStartup: desktopApp.OnStartup,
OnShutdown: desktopApp.OnShutdown,
OnBeforeClose: desktopApp.OnBeforeClose,
Bind: []interface{}{
desktopApp,
},
SingleInstanceLock: &options.SingleInstanceLock{
UniqueId: "deephermes-desktop",
OnSecondInstanceLaunch: func(secondInstanceData options.SecondInstanceData) {
desktopApp.RestoreMainWindow()
},
},
Windows: &windows.Options{
WebviewIsTransparent: false,
WindowIsTranslucent: false,
},
DragAndDrop: &options.DragAndDrop{
EnableFileDrop: true,
DisableWebViewDrop: true,
},
})
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
}