fix(window): set system decorations before window show

Move decoration setting to Rust side so the WM sees correct state when
the window is first mapped. Window starts hidden (visible: false in
tauri.conf.json), Rust reads the persisted setting from SQLite, applies
decorations, then shows the window.

Frontend now persists the setting via Tauri invoke (in addition to
localStorage) so Rust can read it at startup. Inline script in app.html
prevents flash of custom title bar before Svelte mounts.
This commit is contained in:
vicrodh committed 2026-02-09 13:18:50 -06:00
1 parent 7b5bd166d4
commit 32a7f2c807
6 files changed
+210 -7

No files matched your search

+14
View File
@@ -8,6 +8,20 @@
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<script>
// Apply system titlebar state before first render to prevent flash
// of custom title bar when system decorations are enabled.
try {
if (localStorage.getItem('qbz-use-system-titlebar') === 'true' ||
localStorage.getItem('qbz-hide-titlebar') === 'true') {
document.documentElement.dataset.noTitlebar = '';
}
} catch (e) {}
</script>
<style>
/* Hide custom title bar before Svelte hydrates when setting is active */
html[data-no-titlebar] .titlebar { display: none !important; }
</style>
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>