From 252d1e237f44be75ccaa80afbb3cb0e78692e7d3 Mon Sep 17 00:00:00 2001 From: "LAPTOP-O016UC3M\\Qi Chen" <16399091+binaricat@users.noreply.github.com> Date: Mon, 22 Dec 2025 16:29:19 +0800 Subject: [PATCH] Improves window show logic and updates settings window size Adds an option to skip waiting for renderer readiness before showing windows, enabling faster display when appropriate. Updates the default and minimum dimensions of the settings window for a more spacious layout. Adjusts show timeouts to further reduce perceived load time and improve user experience. --- electron/bridges/windowManager.cjs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/electron/bridges/windowManager.cjs b/electron/bridges/windowManager.cjs index 0928e7e15..ff9482d88 100644 --- a/electron/bridges/windowManager.cjs +++ b/electron/bridges/windowManager.cjs @@ -240,7 +240,7 @@ async function waitForRootPaint(win, { timeoutMs = 400, intervalMs = 30 } = {}) return false; } -function setupDeferredShow(win, { timeoutMs = 3000 } = {}) { +function setupDeferredShow(win, { timeoutMs = 3000, waitForRendererReady = true } = {}) { const webContentsId = (() => { try { return win?.webContents?.id; @@ -269,7 +269,9 @@ function setupDeferredShow(win, { timeoutMs = 3000 } = {}) { const tryShow = () => { if (shown) return; - if (readyToShow && rendererReady) showOnce(); + if (!readyToShow) return; + if (waitForRendererReady && !rendererReady) return; + showOnce(); }; const markRendererReady = () => { @@ -398,10 +400,10 @@ async function openSettingsWindow(electronModule, options) { const themeConfig = THEME_COLORS[effectiveTheme] || THEME_COLORS.light; const win = new BrowserWindow({ - width: 800, - height: 650, - minWidth: 700, - minHeight: 500, + width: 980, + height: 720, + minWidth: 820, + minHeight: 600, backgroundColor, icon: appIcon, // NOTE: Do NOT set parent on Windows - it can cause the main window to close @@ -438,7 +440,7 @@ async function openSettingsWindow(electronModule, options) { } // Defer show until renderer is ready; use fallback timeout to avoid keeping window hidden forever. - setupDeferredShow(win, { timeoutMs: isDev ? 3000 : 1500 }); + setupDeferredShow(win, { timeoutMs: isDev ? 1200 : 600, waitForRendererReady: false }); // Clean up reference when closed win.on('closed', () => {