fix(desktop): prevent black screen when closing fullscreen window on macOS
On macOS, calling win.hide() on a fullscreen window causes a black screen because it interrupts the Space transition animation. This is a known macOS Cocoa limitation (NSWindow.orderOut() + fullscreen). Fix: Exit fullscreen first and wait for 'leave-full-screen' event before hiding the window. Also added render-process-gone handler for debugging renderer crashes. Refs: - https://github.com/electron/electron/issues/20263 - https://github.com/electron/electron/issues/6033 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
c10ad352e0
commit
229a709ec8
1 changed files with 15 additions and 1 deletions
|
|
@ -147,11 +147,25 @@ function createWindow() {
|
|||
return { action: 'deny' }
|
||||
})
|
||||
|
||||
// Track renderer crashes for debugging
|
||||
win.webContents.on('render-process-gone', (_event, details) => {
|
||||
console.error('[Window] Renderer process gone:', details.reason, details.exitCode)
|
||||
})
|
||||
|
||||
// Hide window on close instead of quitting (tray keeps running)
|
||||
win.on('close', (event) => {
|
||||
if (!isQuitting) {
|
||||
event.preventDefault()
|
||||
win?.hide()
|
||||
// On macOS, hiding a fullscreen window causes a black screen.
|
||||
// Exit fullscreen first, then hide.
|
||||
if (win?.isFullScreen()) {
|
||||
win.once('leave-full-screen', () => {
|
||||
win?.hide()
|
||||
})
|
||||
win.setFullScreen(false)
|
||||
} else {
|
||||
win?.hide()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue