From cc8b5e61a2cd2de3640f38e99c5d4e0f76464735 Mon Sep 17 00:00:00 2001 From: fatelei Date: Mon, 30 Nov 2026 20:58:22 +0800 Subject: [PATCH] fix(desktop): show the macOS window after the first shell paint --- apps/desktop/src/main.mjs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/main.mjs b/apps/desktop/src/main.mjs index 38f72cf94..428d519ed 100644 --- a/apps/desktop/src/main.mjs +++ b/apps/desktop/src/main.mjs @@ -844,7 +844,12 @@ function buildMenu() { if (!app.requestSingleInstanceLock()) { app.quit(); } else { - app.on('second-instance', () => { window?.show(); window?.focus(); }); + let shellReady = process.platform !== 'darwin'; + app.on('second-instance', () => { + if (!shellReady || quitting) return; + window?.show(); + window?.focus(); + }); app.on('before-quit', event => { if (exitAllowed) return; event.preventDefault(); @@ -870,6 +875,7 @@ else { callback(result.response === 1); }); window = new BrowserWindow({ + show: shellReady, title: 'Open DeepTutor', width: 1360, height: 920, minWidth: 900, minHeight: 620, backgroundColor: currentChromeBackground(), ...(WINDOWS @@ -903,6 +909,12 @@ else { })) ipcMain.handle(`desktop:${channel}`, (event, ...args) => { trustedShell(event); return handler(...args); }); buildMenu(); watchInterface(); + if (!shellReady) { + window.once('ready-to-show', () => { + shellReady = true; + if (!quitting) window.show(); + }); + } await window.loadURL(shellURL); void boot(); }).catch(async error => {