Skip to content

Commit b0f90e1

Browse files
committed
fix(window): 最小化时任务栏右键关闭无响应
close 事件走确认对话框分支前未确保窗口可见,任务栏右键「关闭窗口」 时对话框弹在最小化窗口内、用户不可见,表现为命令无效。发送 window:closing 前先 restore/show/focus。
1 parent 213969c commit b0f90e1

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎client/electron/windowManager.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,12 @@ export function createMainWindow(
163163
} else if (savedChoice === 'minimize') {
164164
win.hide();
165165
} else {
166-
// 无记忆选择,通知前端弹出确认对话框
166+
// 无记忆选择,通知前端弹出确认对话框。
167+
// 窗口可能处于最小化/隐藏状态(如任务栏右键「关闭窗口」),
168+
// 必须先恢复并聚焦,否则应用内对话框用户不可见,表现为“无法关闭”
169+
if (win.isMinimized()) win.restore();
170+
if (!win.isVisible()) win.show();
171+
win.focus();
167172
win.webContents.send('window:closing');
168173
}
169174
} else if (!syncBeforeQuitCompleted) {

0 commit comments

Comments
 (0)