dsh-oc-desktop 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/launcher/main.js +15 -2
- package/package.json +1 -1
package/launcher/main.js
CHANGED
|
@@ -370,11 +370,24 @@ function createMainWindow(url) {
|
|
|
370
370
|
const win = new BrowserWindow(opts);
|
|
371
371
|
win.loadURL(desktopShellUrl(url));
|
|
372
372
|
win.once('ready-to-show', () => {
|
|
373
|
+
log('info', `main window ready-to-show (maximized=${state.maximized})`);
|
|
373
374
|
if (state.maximized) win.maximize();
|
|
374
375
|
win.show();
|
|
376
|
+
// Electron Windows 偶发:show() 执行后窗口仍不可见(win.isVisible()=false)。
|
|
377
|
+
// 延迟重试强制显示,保证窗口一定弹出。
|
|
378
|
+
const forceShow = (attempt) => {
|
|
379
|
+
if (win.isDestroyed()) return;
|
|
380
|
+
if (win.isVisible()) { log('info', `main window visible (attempt=${attempt})`); return; }
|
|
381
|
+
log('warn', `main window invisible after show (attempt=${attempt}) — forcing`);
|
|
382
|
+
if (win.isMinimized()) win.restore();
|
|
383
|
+
win.show();
|
|
384
|
+
win.focus();
|
|
385
|
+
};
|
|
386
|
+
setTimeout(() => forceShow(1), 500);
|
|
387
|
+
setTimeout(() => forceShow(2), 2000);
|
|
375
388
|
});
|
|
376
|
-
win.on('close', () => { saveStateNow(); }); // 关闭=销毁窗口;应用驻留托盘,可从托盘重新打开
|
|
377
|
-
win.on('closed', () => { if (mainWin === win) mainWin = null; });
|
|
389
|
+
win.on('close', () => { log('info', 'main window close'); saveStateNow(); }); // 关闭=销毁窗口;应用驻留托盘,可从托盘重新打开
|
|
390
|
+
win.on('closed', () => { log('info', 'main window closed'); if (mainWin === win) mainWin = null; });
|
|
378
391
|
win.on('maximize', () => { saveStateDebounced(); win.webContents.send('win-maximized', true); });
|
|
379
392
|
win.on('unmaximize', () => { saveStateDebounced(); win.webContents.send('win-maximized', false); });
|
|
380
393
|
win.webContents.on('did-finish-load', () => {
|
package/package.json
CHANGED