persist viewMode across restarts

This commit is contained in:
Eduard Gert
2026-05-27 15:52:15 +02:00
parent a8ad73d2d9
commit ec5da43d73
4 changed files with 34 additions and 4 deletions
+8 -1
View File
@@ -178,10 +178,17 @@ func main() {
app.RegisterService(application.NewService(services.NewI18n(bundle)))
app.RegisterService(application.NewService(services.NewPreferences(prefStore)))
// Open the main window at the width matching the user's last view
// choice so an Advanced-mode user doesn't see the window pop from 380px
// to 900px on every launch. Height is the same in both modes.
initialWidth := 380
if prefStore.Get().ViewMode == preferences.ViewModeAdvanced {
initialWidth = 900
}
window := app.Window.NewWithOptions(application.WebviewWindowOptions{
Name: "main",
Title: "NetBird",
Width: 380,
Width: initialWidth,
Height: 640,
Hidden: true,
BackgroundColour: application.NewRGB(24, 26, 29),