Skip to content

Comments

fix(desktop): persist theme and favorites across restarts#174

Merged
nadaverell merged 3 commits intomainfrom
feature/desktop-settings-persistence
Feb 18, 2026
Merged

fix(desktop): persist theme and favorites across restarts#174
nadaverell merged 3 commits intomainfrom
feature/desktop-settings-persistence

Conversation

@nadaverell
Copy link
Contributor

@nadaverell nadaverell commented Feb 18, 2026

Summary

  • Persist desktop app settings (theme, pinned resource kinds) across restarts via ~/.radar/settings.json
  • Detect Linux system dark mode via xdg-desktop-portal D-Bus and bridge it to WebKitGTK
  • Fix window maximize on Linux (Wails Linux options, GPU policy, MaxWidth/MaxHeight)
  • Fix data loss where saving theme would wipe pinned kinds and vice versa (PUT now merges)

Key files

  • internal/settings/settings.go — Settings load/save with atomic write
  • internal/server/server.goGET/PUT /api/settings with read-modify-write semantics
  • cmd/desktop/theme_linux.go — D-Bus color-scheme query, sets GTK_THEME for WebKitGTK
  • cmd/desktop/theme_other.go — No-op stub for macOS/Windows
  • cmd/desktop/main.goapplySystemTheme() call, Linux Wails options, MaxWidth/MaxHeight
  • web/src/context/ThemeContext.tsx, web/src/hooks/useFavorites.ts — Server sync + error logging

Desktop app uses Port: 0 which assigns a random OS port each launch.
Since localStorage is origin-scoped, user preferences (theme, pinned
resource kinds) were lost on every restart. Add server-side settings
file at ~/.radar/settings.json and sync frontend state via REST API.
@nadaverell nadaverell requested a review from hisco as a code owner February 18, 2026 21:18
Query xdg-desktop-portal D-Bus interface to detect system color scheme
on Linux and set GTK_THEME so WebKitGTK's prefers-color-scheme works on
GNOME 42+. Add Wails Linux options with ProgramName and GPU policy
OnDemand (fixes default Never when Linux is nil). Set MaxWidth/MaxHeight
to 7680x4320 to prevent Wails auto-detection from constraining window
sizing on Wayland.
PUT /api/settings was decoding into a fresh struct, so saving theme
would zero out pinnedKinds and vice versa. Now decodes into the
existing settings so only provided fields are overwritten.

Also add console.warn logging to frontend catch blocks and backend
settings.Load() for non-NotExist errors to aid debugging.
@nadaverell nadaverell merged commit 435f2ae into main Feb 18, 2026
4 of 5 checks passed
@nadaverell nadaverell deleted the feature/desktop-settings-persistence branch February 18, 2026 22:16
nadaverell added a commit that referenced this pull request Feb 19, 2026
* fix(desktop): persist theme and favorites across restarts

Desktop app uses Port: 0 which assigns a random OS port each launch.
Since localStorage is origin-scoped, user preferences (theme, pinned
resource kinds) were lost on every restart. Add server-side settings
file at ~/.radar/settings.json and sync frontend state via REST API.

* fix(desktop): detect Linux dark theme and fix window maximize

Query xdg-desktop-portal D-Bus interface to detect system color scheme
on Linux and set GTK_THEME so WebKitGTK's prefers-color-scheme works on
GNOME 42+. Add Wails Linux options with ProgramName and GPU policy
OnDemand (fixes default Never when Linux is nil). Set MaxWidth/MaxHeight
to 7680x4320 to prevent Wails auto-detection from constraining window
sizing on Wayland.

* fix(desktop): merge settings on PUT to prevent data loss

PUT /api/settings was decoding into a fresh struct, so saving theme
would zero out pinnedKinds and vice versa. Now decodes into the
existing settings so only provided fields are overwritten.

Also add console.warn logging to frontend catch blocks and backend
settings.Load() for non-NotExist errors to aid debugging.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant