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 => {