diff --git a/src/lib/components/views/SettingsView.svelte b/src/lib/components/views/SettingsView.svelte index 1a9e4322e..3b9d574e6 100644 --- a/src/lib/components/views/SettingsView.svelte +++ b/src/lib/components/views/SettingsView.svelte @@ -46,9 +46,7 @@ import { showToast } from '$lib/stores/toastStore'; import { subscribe as subscribeTitleBar, - getUseCustomTitleBar, getHideTitleBar, - setUseCustomTitleBar, setHideTitleBar } from '$lib/stores/titleBarStore'; import { @@ -376,7 +374,6 @@ let language = $state('Auto'); // Title bar settings - let useCustomTitleBar = $state(getUseCustomTitleBar()); let hideTitleBar = $state(getHideTitleBar()); // Library settings @@ -483,7 +480,6 @@ // Subscribe to title bar state changes const unsubscribeTitleBar = subscribeTitleBar(() => { - useCustomTitleBar = getUseCustomTitleBar(); hideTitleBar = getHideTitleBar(); }); @@ -1682,17 +1678,6 @@ {$t('settings.appearance.systemNotifications')} { systemNotificationsEnabled = v; setSystemNotificationsEnabled(v); }} /> -
-
- {$t('settings.appearance.useCustomTitleBar')} - {$t('settings.appearance.useCustomTitleBarDesc')} -
- setUseCustomTitleBar(v)} - /> -
{$t('settings.appearance.hideTitleBar')} diff --git a/src/lib/i18n/locales/en.json b/src/lib/i18n/locales/en.json index 71134c6fe..6d5540194 100644 --- a/src/lib/i18n/locales/en.json +++ b/src/lib/i18n/locales/en.json @@ -364,9 +364,7 @@ "uiScale": "UI Scale", "inAppToasts": "In-app toasts notifications", "systemNotifications": "System Notifications", - "useCustomTitleBar": "Use QBZ title bar", - "useCustomTitleBarDesc": "Use the custom QBZ title bar instead of system decorations", - "hideTitleBar": "Remove title bar", + "hideTitleBar": "Hide title bar", "hideTitleBarDesc": "Hide the title bar completely (for tiling window manager users)" }, "library": { diff --git a/src/lib/i18n/locales/es.json b/src/lib/i18n/locales/es.json index c01237ad9..6e5e099f0 100644 --- a/src/lib/i18n/locales/es.json +++ b/src/lib/i18n/locales/es.json @@ -364,8 +364,6 @@ "uiScale": "Escala de UI", "inAppToasts": "Notificaciones en App", "systemNotifications": "Notificaciones del Sistema", - "useCustomTitleBar": "Usar barra de título de QBZ", - "useCustomTitleBarDesc": "Usar la barra de título personalizada de QBZ en lugar de las decoraciones del sistema", "hideTitleBar": "Ocultar barra de título", "hideTitleBarDesc": "Ocultar completamente la barra de título (para usuarios de gestores de ventanas en mosaico)" }, diff --git a/src/lib/stores/titleBarStore.ts b/src/lib/stores/titleBarStore.ts index afcc0b9e2..77c0cfffc 100644 --- a/src/lib/stores/titleBarStore.ts +++ b/src/lib/stores/titleBarStore.ts @@ -4,17 +4,12 @@ * Manages title bar visibility settings with localStorage persistence. * * Settings: - * - useCustomTitleBar: Use QBZ custom title bar (default: true) * - hideTitleBar: Remove title bar completely for tiling WM users (default: false) */ -import { getCurrentWindow } from '@tauri-apps/api/window'; - -const STORAGE_KEY_CUSTOM = 'qbz-use-custom-titlebar'; const STORAGE_KEY_HIDE = 'qbz-hide-titlebar'; // State -let useCustomTitleBar = true; let hideTitleBar = false; // Listeners @@ -27,22 +22,14 @@ function notifyListeners(): void { } /** - * Initialize the store from localStorage and apply settings + * Initialize the store from localStorage */ -export async function initTitleBarStore(): Promise { +export function initTitleBarStore(): void { try { - const savedCustom = localStorage.getItem(STORAGE_KEY_CUSTOM); const savedHide = localStorage.getItem(STORAGE_KEY_HIDE); - - if (savedCustom !== null) { - useCustomTitleBar = savedCustom === 'true'; - } if (savedHide !== null) { hideTitleBar = savedHide === 'true'; } - - // Apply settings to window - await applyTitleBarSettings(); } catch (e) { console.error('[TitleBarStore] Failed to initialize:', e); } @@ -58,24 +45,17 @@ export function subscribe(listener: () => void): () => void { } /** - * Get current settings + * Get current setting */ -export function getUseCustomTitleBar(): boolean { - return useCustomTitleBar; -} - export function getHideTitleBar(): boolean { return hideTitleBar; } /** - * Determine if the custom title bar should be visible - * - Hidden if hideTitleBar is true (tiling WM mode) - * - Hidden if useCustomTitleBar is false (using system decorations) + * Determine if the title bar should be visible */ export function shouldShowTitleBar(): boolean { - if (hideTitleBar) return false; - return useCustomTitleBar; + return !hideTitleBar; } /** @@ -83,53 +63,16 @@ export function shouldShowTitleBar(): boolean { * Returns 0 if title bar is hidden, 32 otherwise */ export function getTitleBarHeight(): number { - return shouldShowTitleBar() ? 32 : 0; -} - -/** - * Apply current settings to the Tauri window - */ -async function applyTitleBarSettings(): Promise { - try { - const appWindow = getCurrentWindow(); - - if (hideTitleBar) { - // No title bar at all - remove decorations - await appWindow.setDecorations(false); - } else if (useCustomTitleBar) { - // Custom title bar - no system decorations - await appWindow.setDecorations(false); - } else { - // System title bar - enable decorations - await appWindow.setDecorations(true); - } - } catch (e) { - console.error('[TitleBarStore] Failed to apply settings:', e); - } -} - -/** - * Set whether to use custom title bar - */ -export async function setUseCustomTitleBar(value: boolean): Promise { - useCustomTitleBar = value; - try { - localStorage.setItem(STORAGE_KEY_CUSTOM, String(value)); - await applyTitleBarSettings(); - } catch (e) { - console.error('[TitleBarStore] Failed to save custom titlebar setting:', e); - } - notifyListeners(); + return hideTitleBar ? 0 : 32; } /** * Set whether to hide title bar completely */ -export async function setHideTitleBar(value: boolean): Promise { +export function setHideTitleBar(value: boolean): void { hideTitleBar = value; try { localStorage.setItem(STORAGE_KEY_HIDE, String(value)); - await applyTitleBarSettings(); } catch (e) { console.error('[TitleBarStore] Failed to save hide titlebar setting:', e); } @@ -137,7 +80,6 @@ export async function setHideTitleBar(value: boolean): Promise { } export interface TitleBarState { - useCustomTitleBar: boolean; hideTitleBar: boolean; showTitleBar: boolean; titleBarHeight: number; @@ -145,7 +87,6 @@ export interface TitleBarState { export function getTitleBarState(): TitleBarState { return { - useCustomTitleBar, hideTitleBar, showTitleBar: shouldShowTitleBar(), titleBarHeight: getTitleBarHeight() diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 95accdf30..e9d93a318 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -75,7 +75,6 @@ import { subscribe as subscribeTitleBar, initTitleBarStore, - getTitleBarState, shouldShowTitleBar } from '$lib/stores/titleBarStore';