Add configurable black app icons and logo (#564)

This commit is contained in:
vrustx authored and GitHub committed 2026-05-31 10:15:59 +08:00
1 parent c0b231374d
commit bc4e912504
14 files changed
+240 -29

No files matched your search

+15 -3
View File
@@ -38,12 +38,24 @@ export interface AiConfig {
export interface DesktopSettings {
show_tray_icon: boolean;
icon_theme: DesktopIconTheme;
}
export type DesktopIconTheme = "default" | "black";
export const DEFAULT_DESKTOP_SETTINGS: DesktopSettings = {
show_tray_icon: true,
icon_theme: "default",
};
function normalizeDesktopSettings(settings: Partial<DesktopSettings> | null | undefined): DesktopSettings {
const iconTheme = settings?.icon_theme === "black" ? "black" : DEFAULT_DESKTOP_SETTINGS.icon_theme;
return {
show_tray_icon: settings?.show_tray_icon ?? DEFAULT_DESKTOP_SETTINGS.show_tray_icon,
icon_theme: iconTheme,
};
}
export interface AiProviderPreset extends Omit<AiConfig, "apiKey"> {
label: string;
iconSlug?: string;
@@ -415,7 +427,7 @@ export const useSettingsStore = defineStore("settings", () => {
async function initDesktopSettings() {
if (isDesktopSettingsLoaded.value) return;
desktopSettings.value = await api.loadDesktopSettings().catch(() => ({ ...DEFAULT_DESKTOP_SETTINGS }));
desktopSettings.value = normalizeDesktopSettings(await api.loadDesktopSettings().catch(() => null));
isDesktopSettingsLoaded.value = true;
}
@@ -425,9 +437,9 @@ export const useSettingsStore = defineStore("settings", () => {
...desktopSettings.value,
...partial,
};
desktopSettings.value = next;
desktopSettings.value = normalizeDesktopSettings(next);
try {
await api.saveDesktopSettings(next);
await api.saveDesktopSettings(desktopSettings.value);
} catch (error) {
desktopSettings.value = previous;
throw error;