From f284ac92bc6723ee2e030089abc48761214f670b Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Mon, 9 Feb 2026 14:34:24 -0600 Subject: [PATCH] fix(window): hide window until webview renders to avoid empty frame Create the window with visible:false so the empty frame + title bar don't flash while the webview loads. The frontend calls show_main_window from onMount (after first DOM paint) to reveal the window with content already rendered. --- src-tauri/src/lib.rs | 11 +++++++++++ src/routes/+page.svelte | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 56f09b05a..0e4075835 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -146,6 +146,15 @@ fn restart_app(app: tauri::AppHandle) { app.restart(); } +#[tauri::command] +fn show_main_window(app: tauri::AppHandle) -> Result<(), String> { + if let Some(window) = app.get_webview_window("main") { + window.show().map_err(|e| format!("Failed to show window: {}", e)) + } else { + Err("Main window not found".to_string()) + } +} + pub fn run() { // Load .env file if present (for development) // Silently ignore if not found (production builds use compile-time env vars) @@ -303,6 +312,7 @@ pub fn run() { .min_inner_size(800.0, 600.0) .decorations(use_system_titlebar) .transparent(true) + .visible(false) .resizable(true) .zoom_hotkeys_enabled(true) .build() @@ -990,6 +1000,7 @@ pub fn run() { config::window_settings::set_use_system_titlebar, // App lifecycle commands restart_app, + show_main_window, // Log capture commands logging::get_backend_logs, logging::upload_logs_to_paste, diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 7026a6475..4903a6bbe 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -2524,6 +2524,13 @@ } onMount(() => { + // Show window now that the DOM has been painted. + // The window starts hidden (visible:false) to avoid showing an + // empty frame while the webview loads. + invoke('show_main_window').catch((e) => { + console.error('Failed to show main window:', e); + }); + // Bootstrap app (theme, mouse nav, Last.fm restore) const { cleanup: cleanupBootstrap } = bootstrapApp();