feat(app): socketBridge getConfig/setConfig + config_changed

This commit is contained in:
2026-06-14 09:37:45 +07:00
parent 62f1f8e9a8
commit b9f46a407d
+25
View File
@@ -94,6 +94,7 @@ export type DaemonEvt =
| { evt: "layout_changed"; data: { workspace_id: string } }
| { evt: "workspace_changed"; data: unknown }
| { evt: "groups_changed"; data: unknown }
| { evt: "config_changed"; data: { config: ConfigView } }
| { evt: "event"; data: { record: EventRecord } }
| { evt: "events_read"; data: { ids: number[] } };
@@ -186,3 +187,27 @@ export async function getHealth(): Promise<DaemonHealth> {
export async function setZoom(workspaceId: string, surfaceId: string | null): Promise<void> {
await invoke("set_zoom", { workspaceId, surfaceId });
}
// ---- Settings ----
export interface ConfigView {
default_shell: string;
font_family: string;
font_size: number;
theme: "dark" | "light";
accent: string;
}
export async function getConfig(): Promise<ConfigView> {
return await invoke<ConfigView>("get_config");
}
export async function setConfig(patch: Partial<Pick<ConfigView, "default_shell" | "font_family" | "font_size" | "theme" | "accent">>): Promise<void> {
await invoke("set_config", {
defaultShell: patch.default_shell ?? null,
fontFamily: patch.font_family ?? null,
fontSize: patch.font_size ?? null,
theme: patch.theme ?? null,
accent: patch.accent ?? null,
});
}