fix(desktop): show the macOS window after the first shell paint

This commit is contained in:
fatelei
2026-11-30 20:58:22 +08:00
parent fea1be2c97
commit cc8b5e61a2

View File

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