fix(window): always restart on system titlebar toggle

Runtime decoration toggling doesn't work reliably in either direction
on Linux/Wayland. Always restart the app so the window is recreated
with the correct decoration state.
This commit is contained in:
vicrodh committed 2026-02-09 14:40:31 -06:00
1 parent cb6c86324c
commit fcafac095c
5 files changed
+8 -19

No files matched your search

+1 -1
View File
@@ -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. Beim Aktivieren wird die App neu gestartet.",
"useSystemTitleBarDesc": "QBZ-eigene Titelleiste durch die native Fensterdekoration des Systems ersetzen. Änderung startet die App neu.",
"hideTitleBar": "Titelleiste ausblenden",
"hideTitleBarDesc": "Titelleiste komplett ausblenden (für Tiling-Window-Manager-Nutzer)",
"immersiveDefaultView": "Standard-Ansicht im Immersiv-Modus",
+1 -1
View File
@@ -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. Enabling this will restart the app.",
"useSystemTitleBarDesc": "Replace QBZ custom title bar with your system's native window decorations. Changing this will restart the app.",
"hideTitleBar": "Hide title bar",
"hideTitleBarDesc": "Hide the title bar completely (for tiling window manager users)",
"immersiveDefaultView": "Immersive default view",
+1 -1
View File
@@ -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. Activarlo reiniciará la app.",
"useSystemTitleBarDesc": "Reemplazar la barra de título personalizada de QBZ con las decoraciones nativas de tu sistema. Cambiar esto 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",
+1 -1
View File
@@ -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'activation redémarrera l'application.",
"useSystemTitleBarDesc": "Remplacer la barre de titre personnalisée de QBZ par les décorations natives de votre système. Ce changement 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",
+4 -15
View File
@@ -8,7 +8,6 @@
* - 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';
@@ -108,12 +107,9 @@ export function setHideTitleBar(value: boolean): void {
/**
* Set whether to use system (OS native) title bar.
*
* 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.
* Persists to both localStorage and Rust backend, then restarts the app.
* Restart is required because the window must be created with the correct
* decoration state — runtime toggling doesn't work reliably on Linux/Wayland.
*/
export async function setUseSystemTitleBar(value: boolean): Promise<void> {
useSystemTitleBar = value;
@@ -124,14 +120,7 @@ export async function setUseSystemTitleBar(value: boolean): Promise<void> {
}
try {
await invoke('set_use_system_titlebar', { value });
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();
}
await invoke('restart_app');
} catch (e) {
console.error('[TitleBarStore] Failed to apply system titlebar change:', e);
}