-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
116 lines (104 loc) · 3.1 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package main
import (
"embed"
"fmt"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/logger"
"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"
"os"
"path/filepath"
)
//go:embed all:frontend/dist
var assets embed.FS
var homeDir string
var exeDir string
var cliDir string
var log logger.Logger
func main() {
homeDir, _ = os.UserHomeDir()
exeDir, _ = os.Executable()
homeDir = filepath.Join(homeDir, "Lethean")
cliDir = filepath.Join(homeDir, "cli")
fmt.Println("HomeDir" + homeDir)
if _, err := os.Stat(filepath.Join(homeDir, "data", "logs")); err != nil {
err = os.MkdirAll(filepath.Join(homeDir, "data", "logs"), os.ModePerm)
}
log = logger.NewFileLogger(filepath.Join(homeDir, "data", "logs", "desktop.log"))
fmt.Println("Using Base Directory: " + homeDir)
// Create an instance of the app structure
app := NewApp()
var logLvl logger.LogLevel
envLog, ok := os.LookupEnv("LTHN_LOG_LEVEL")
if !ok {
logLvl = 4
} else {
log.Debug("LogLevel adjusted to " + envLog)
logLvl, _ = logger.StringToLogLevel(envLog)
}
// Create application with options
err := wails.Run(&options.App{
Title: "Lethean",
Width: 1280,
Height: 740,
// MinWidth: 720,
// MinHeight: 570,
// MaxWidth: 1280,
// MaxHeight: 740,
DisableResize: false,
Fullscreen: false,
Frameless: false,
StartHidden: false,
HideWindowOnClose: false,
BackgroundColour: &options.RGBA{R: 255, G: 255, B: 255, A: 255},
AssetServer: &assetserver.Options{
Assets: assets,
},
LogLevel: logLvl,
OnStartup: app.startup,
OnDomReady: app.domReady,
OnShutdown: app.shutdown,
WindowStartState: options.Maximised,
Bind: []interface{}{
app,
},
// Windows platform specific options
Windows: &windows.Options{
WebviewIsTransparent: false,
WindowIsTranslucent: false,
DisableWindowIcon: false,
DisableFramelessWindowDecorations: false,
Theme: windows.SystemDefault,
CustomTheme: &windows.ThemeSettings{
DarkModeTitleBar: windows.RGB(20, 20, 20),
DarkModeTitleText: windows.RGB(200, 200, 200),
DarkModeBorder: windows.RGB(20, 0, 20),
LightModeTitleBar: windows.RGB(200, 200, 200),
LightModeTitleText: windows.RGB(20, 20, 20),
LightModeBorder: windows.RGB(200, 200, 200),
},
},
Mac: &mac.Options{
TitleBar: &mac.TitleBar{
TitlebarAppearsTransparent: false,
HideTitle: false,
HideTitleBar: false,
FullSizeContent: false,
UseToolbar: true,
HideToolbarSeparator: false,
},
Appearance: mac.NSAppearanceNameDarkAqua,
WebviewIsTransparent: true,
WindowIsTranslucent: false,
About: &mac.AboutInfo{
Title: "Lethean Desktop",
Message: "© Lethean Community Interest Company",
},
},
})
if err != nil {
fmt.Println("error: ", err)
}
}