{
+ const update = desktopSettingsQueue
+ .catch(() => {})
+ .then(async () => {
+ // A settings event that lands while the request is in flight is newer
+ // than its reply, so the reply must not overwrite it.
+ const revision = desktopSettingsRevision
+ try {
+ const state = await setAppSettings(patch)
+ if (revision === desktopSettingsRevision) applyAppSettingsState(state)
+ } catch (err) {
+ console.warn("[settings] setAppSettings failed:", err)
+ try {
+ const state = await getAppSettings()
+ if (revision === desktopSettingsRevision) applyAppSettingsState(state)
+ } catch {}
+ }
+ })
+ desktopSettingsQueue = update.catch(() => {})
+ await update
+}
+
+export async function initDesktopSettingsListener(): Promise<() => void> {
+ const unlisten = await onAppSettingsChanged((state) => {
+ desktopSettingsRevision++
+ applyAppSettingsState(state)
+ })
+ return unlisten
+}
+
// ── Init ────────────────────────────────────────────────────────────
export function initSettings() {
@@ -402,10 +481,7 @@ export function getWorkspaceFolder(workspaceId: string): string {
return ""
}
-export function setWorkspaceFolder(
- workspaceId: string,
- folder: string,
-): void {
+export function setWorkspaceFolder(workspaceId: string, folder: string): void {
if (!browser) return
try {
const stored = localStorage.getItem(WORKSPACE_FOLDERS_KEY)
diff --git a/desktop/src/renderer/src/pages/SettingsPage.svelte b/desktop/src/renderer/src/pages/SettingsPage.svelte
index e8d016acb..6bfc04690 100644
--- a/desktop/src/renderer/src/pages/SettingsPage.svelte
+++ b/desktop/src/renderer/src/pages/SettingsPage.svelte
@@ -19,6 +19,12 @@ import {
localOptions as localOptionsStore,
loadLocalOptions,
saveLocalOption,
+ runAtStartup,
+ openToTrayOnStartup,
+ trayNotifications,
+ startupStatus,
+ syncDesktopSettingsFromMain,
+ updateDesktopSettings,
} from "$lib/stores/settings.js"
import type {
Theme,
@@ -26,6 +32,7 @@ import type {
LocalOptions,
OnBuildFailure,
} from "$lib/stores/settings.js"
+import type { TrayNotificationLevel } from "$shared/app-settings.js"
import * as Select from "$lib/components/ui/select/index.js"
import UpdatesPanel from "$lib/components/update/UpdatesPanel.svelte"
import { Skeleton } from "$lib/components/ui/skeleton/index.js"
@@ -121,10 +128,18 @@ const shortcuts = [
{ keys: "Escape", action: "Close dialogs and palette" },
]
+const NOTIFICATION_OPTIONS: { value: TrayNotificationLevel; label: string }[] =
+ [
+ { value: "off", label: "Off" },
+ { value: "failures", label: "Failures only" },
+ { value: "all", label: "All terminal outcomes" },
+ ]
+
onMount(() => {
local = loadLocalOptions()
localOptionsStore.set(local)
loading = false
+ void syncDesktopSettingsFromMain()
})
function saveLocal(key: keyof LocalOptions, value: string | boolean) {
@@ -273,6 +288,67 @@ function toggleLocal(key: keyof LocalOptions) {
{/if}
+
+
+
+