diff --git a/src/lib/i18n/locales/de.json b/src/lib/i18n/locales/de.json index 1c5005498..84af1b84a 100644 --- a/src/lib/i18n/locales/de.json +++ b/src/lib/i18n/locales/de.json @@ -598,7 +598,7 @@ "inAppToasts": "In-App-Benachrichtigungen", "systemNotifications": "Systembenachrichtigungen", "useSystemTitleBar": "System-Titelleiste verwenden", - "useSystemTitleBarDesc": "QBZ-eigene Titelleiste durch die native Fensterdekoration des Systems ersetzen. Die App wird neu gestartet, um diese Änderung anzuwenden.", + "useSystemTitleBarDesc": "QBZ-eigene Titelleiste durch die native Fensterdekoration des Systems ersetzen. Beim Aktivieren wird die App neu gestartet.", "hideTitleBar": "Titelleiste ausblenden", "hideTitleBarDesc": "Titelleiste komplett ausblenden (für Tiling-Window-Manager-Nutzer)", "immersiveDefaultView": "Standard-Ansicht im Immersiv-Modus", diff --git a/src/lib/i18n/locales/en.json b/src/lib/i18n/locales/en.json index f33fdc8dc..dffe936cb 100644 --- a/src/lib/i18n/locales/en.json +++ b/src/lib/i18n/locales/en.json @@ -617,7 +617,7 @@ "inAppToasts": "In-app toasts notifications", "systemNotifications": "System Notifications", "useSystemTitleBar": "Use system title bar", - "useSystemTitleBarDesc": "Replace QBZ custom title bar with your system's native window decorations. The app will restart to apply this change.", + "useSystemTitleBarDesc": "Replace QBZ custom title bar with your system's native window decorations. Enabling this will restart the app.", "hideTitleBar": "Hide title bar", "hideTitleBarDesc": "Hide the title bar completely (for tiling window manager users)", "immersiveDefaultView": "Immersive default view", diff --git a/src/lib/i18n/locales/es.json b/src/lib/i18n/locales/es.json index 6261bdcf1..cb8fbd536 100644 --- a/src/lib/i18n/locales/es.json +++ b/src/lib/i18n/locales/es.json @@ -617,7 +617,7 @@ "inAppToasts": "Notificaciones en App", "systemNotifications": "Notificaciones del Sistema", "useSystemTitleBar": "Usar barra de título del sistema", - "useSystemTitleBarDesc": "Reemplazar la barra de título personalizada de QBZ con las decoraciones nativas de tu sistema. La app se reiniciará para aplicar este cambio.", + "useSystemTitleBarDesc": "Reemplazar la barra de título personalizada de QBZ con las decoraciones nativas de tu sistema. Activarlo reiniciará la app.", "hideTitleBar": "Ocultar barra de título", "hideTitleBarDesc": "Ocultar completamente la barra de título (para usuarios de gestores de ventanas en mosaico)", "immersiveDefaultView": "Vista predeterminada del modo inmersivo", diff --git a/src/lib/i18n/locales/fr.json b/src/lib/i18n/locales/fr.json index 94ef9b864..ab4a174fb 100644 --- a/src/lib/i18n/locales/fr.json +++ b/src/lib/i18n/locales/fr.json @@ -598,7 +598,7 @@ "inAppToasts": "Notifications toast intégrées", "systemNotifications": "Notifications système", "useSystemTitleBar": "Utiliser la barre de titre du système", - "useSystemTitleBarDesc": "Remplacer la barre de titre personnalisée de QBZ par les décorations natives de votre système. L'application redémarrera pour appliquer ce changement.", + "useSystemTitleBarDesc": "Remplacer la barre de titre personnalisée de QBZ par les décorations natives de votre système. L'activation redémarrera l'application.", "hideTitleBar": "Masquer la barre de titre", "hideTitleBarDesc": "Masquer complètement la barre de titre (pour les utilisateurs de gestionnaires de fenêtres en mosaïque)", "immersiveDefaultView": "Vue par défaut du mode immersif", diff --git a/src/lib/stores/titleBarStore.ts b/src/lib/stores/titleBarStore.ts index 7b9de7555..fa43065a3 100644 --- a/src/lib/stores/titleBarStore.ts +++ b/src/lib/stores/titleBarStore.ts @@ -8,6 +8,7 @@ * - useSystemTitleBar: Use OS native window decorations instead of custom title bar (default: false) */ +import { getCurrentWindow } from '@tauri-apps/api/window'; import { invoke } from '@tauri-apps/api/core'; const STORAGE_KEY_HIDE = 'qbz-hide-titlebar'; @@ -107,9 +108,12 @@ export function setHideTitleBar(value: boolean): void { /** * Set whether to use system (OS native) title bar. - * Persists to both localStorage and Rust backend, then restarts the app. - * Restart is required because the window must be created with the correct - * decorations value — runtime toggling doesn't work on Linux/Wayland. + * + * Enabling: persists + restarts the app (window must be born with + * decorations:true on Linux/Wayland for buttons to work). + * + * Disabling: removes OS decorations at runtime and restores the custom + * title bar immediately — no restart needed. */ export async function setUseSystemTitleBar(value: boolean): Promise { useSystemTitleBar = value; @@ -118,13 +122,18 @@ export async function setUseSystemTitleBar(value: boolean): Promise { } catch (e) { console.error('[TitleBarStore] Failed to save system titlebar setting:', e); } - // Persist to Rust backend, then restart so the window is recreated - // with the correct decoration state try { await invoke('set_use_system_titlebar', { value }); - await invoke('restart_app'); + if (value) { + // Enabling: restart so the window is created with decorations:true + await invoke('restart_app'); + } else { + // Disabling: remove OS decorations at runtime (this direction works) + await getCurrentWindow().setDecorations(false); + notifyListeners(); + } } catch (e) { - console.error('[TitleBarStore] Failed to persist/restart:', e); + console.error('[TitleBarStore] Failed to apply system titlebar change:', e); } }