Add font settings

This commit is contained in:
2025-05-29 15:42:16 +08:00
parent 5f102edcf7
commit 44f7baad10
28 changed files with 710 additions and 13 deletions

31
main.go
View File

@@ -24,6 +24,14 @@ var assets embed.FS
// logs any error that might occur.
func main() {
serviceManager := services.NewServiceManager()
var encryptionKey = [32]byte{
0x1e, 0x1f, 0x1c, 0x1d, 0x1a, 0x1b, 0x18, 0x19,
0x16, 0x17, 0x14, 0x15, 0x12, 0x13, 0x10, 0x11,
0x0e, 0x0f, 0x0c, 0x0d, 0x0a, 0x0b, 0x08, 0x09,
0x06, 0x07, 0x04, 0x05, 0x02, 0x03, 0x00, 0x01,
}
var window *application.WebviewWindow
// Create a new Wails application by providing the necessary options.
// Variables 'Name' and 'Description' are for application metadata.
// 'Assets' configures the asset server with the 'FS' variable pointing to the frontend files.
@@ -39,6 +47,25 @@ func main() {
Mac: application.MacOptions{
ApplicationShouldTerminateAfterLastWindowClosed: true,
},
SingleInstance: &application.SingleInstanceOptions{
UniqueID: "com.voidraft",
EncryptionKey: encryptionKey,
OnSecondInstanceLaunch: func(data application.SecondInstanceData) {
if window != nil {
window.EmitEvent("secondInstanceLaunched", data)
window.Restore()
window.Focus()
}
log.Printf("Second instance launched with args: %v\n", data.Args)
log.Printf("Working directory: %s\n", data.WorkingDir)
if data.AdditionalData != nil {
log.Printf("Additional data: %v\n", data.AdditionalData)
}
},
AdditionalData: map[string]string{
"launchtime": time.Now().Local().String(),
},
},
})
// Create a new window with the necessary options.
@@ -58,7 +85,7 @@ func main() {
TitleBar: application.MacTitleBarHiddenInset,
},
BackgroundColour: application.NewRGB(27, 38, 54),
URL: "/",
URL: "/#/",
})
mainWindow.Center()
settingsWindow := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
@@ -77,7 +104,7 @@ func main() {
},
Windows: application.WindowsWindow{},
BackgroundColour: application.NewRGB(27, 38, 54),
URL: "/settings",
URL: "/#/settings",
})
settingsWindow.Center()