Merge pull request #192 from aaronraimist/close-fullscreen-macos

Prevent black screen when closing window while in full screen mode on macOS
This commit is contained in:
J. Ryan Stinnett 2021-05-05 16:54:48 +01:00 committed by GitHub
commit 75b41d65c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -955,7 +955,15 @@ app.on('ready', async () => {
// (this is generally how single-window Mac apps
// behave, eg. Mail.app)
e.preventDefault();
mainWindow.hide();
if (mainWindow.isFullScreen()) {
mainWindow.once('leave-full-screen', () => mainWindow.hide());
mainWindow.setFullScreen(false);
} else {
mainWindow.hide();
}
return false;
}
});