Skip to content

Commit

Permalink
fix closing main window when full screen on macOS
Browse files Browse the repository at this point in the history
Fixes #299
  • Loading branch information
timche committed Feb 12, 2022
1 parent baa145a commit 53c8dd4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/main-window/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ export function createMainWindow(): void {
})

mainWindow.on('close', (event) => {
// Workaround: Closing the main window when on full screen leaves a black screen
// https://github.com/electron/electron/issues/20263
if (is.macos && mainWindow?.isFullScreen()) {
mainWindow.once('leave-full-screen', () => {
mainWindow?.hide()
})
mainWindow.setFullScreen(false)
}

if (!getIsQuittingApp() && mainWindow) {
event.preventDefault()
mainWindow.blur()
Expand Down

0 comments on commit 53c8dd4

Please sign in to comment.