From 0f28be13009260dbf1e8f790401cc6b947f6940f Mon Sep 17 00:00:00 2001 From: Vassiliy Yegorov Date: Sun, 14 Jun 2026 09:41:15 +0700 Subject: [PATCH] feat(app): apply theme from daemon config on load and live Co-Authored-By: Claude Sonnet 4.6 --- app/src/App.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/src/App.tsx b/app/src/App.tsx index b9b4d2e..feb9b08 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -7,9 +7,9 @@ import { Wizard } from "./Wizard"; import { ConfirmDelete } from "./ConfirmDelete"; import { EventCenter } from "./EventCenter"; import { maybeNotify } from "./notify"; -import { COLORS } from "./theme"; -import { getStatusFull, applyPreset, onDaemonEvent, onDaemonRawEvent, setWorkspaceMeta, focusSurface, getEventLog, markEventsRead, getHealth, closeWorkspaceCmd } from "./socketBridge"; -import type { EventRecord, DaemonHealth } from "./socketBridge"; +import { COLORS, applyTheme } from "./theme"; +import { getStatusFull, applyPreset, onDaemonEvent, onDaemonRawEvent, setWorkspaceMeta, focusSurface, getEventLog, markEventsRead, getHealth, closeWorkspaceCmd, getConfig } from "./socketBridge"; +import type { EventRecord, DaemonHealth, ConfigView } from "./socketBridge"; import { leafIds } from "./layoutTypes"; import type { Group, WorkspaceView, SurfaceState } from "./layoutTypes"; @@ -34,6 +34,7 @@ export function App() { const [eventsOpen, setEventsOpen] = useState(() => loadFlag("spacesh.eventsOpen", true)); const [sidebarOpen, setSidebarOpen] = useState(() => loadFlag("spacesh.sidebarOpen", true)); const [health, setHealth] = useState(null); + const [config, setConfigState] = useState(null); const [connected, setConnected] = useState(false); const [focusedId, setFocusedId] = useState(null); const [searchSurfaceId, setSearchSurfaceId] = useState(null); @@ -78,6 +79,7 @@ export function App() { void refresh(); void seedEvents(); void loadHealth(); + void getConfig().then((c) => { setConfigState(c); applyTheme(c.theme, c.accent); }).catch(() => {}); const unlisten = onDaemonEvent((evt) => { if (evt.evt === "event") { const rec = evt.data.record; @@ -93,6 +95,10 @@ export function App() { void refresh(); } else if (evt.evt === "exit") { void refresh(); + } else if (evt.evt === "config_changed") { + const c = evt.data.config; + setConfigState(c); + applyTheme(c.theme, c.accent); } else { void refresh(); } @@ -102,6 +108,7 @@ export function App() { void refresh(); void seedEvents(); void loadHealth(); + void getConfig().then((c) => { setConfigState(c); applyTheme(c.theme, c.accent); }).catch(() => {}); }); return () => { void unlisten.then((f) => f()); void reconnect.then((f) => f()); }; }, [refresh, seedEvents, loadHealth]);