Reduce number of cases where playback is disabled

This commit is contained in:
Fedor Indutny 2024-08-02 09:52:06 -07:00 committed by GitHub
parent 9010245083
commit 22192a4037
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -843,12 +843,6 @@ async function createWindow() {
// App dock icon bounce
bounce.init(mainWindow);
mainWindow.on('hide', () => {
if (mainWindow && !windowState.shouldQuit()) {
mainWindow.webContents.send('set-media-playback-disabled', true);
}
});
// Emitted when the window is about to be closed.
// Note: We do most of our shutdown logic here because all windows are closed by
// Electron before the app quits.
@ -873,6 +867,9 @@ async function createWindow() {
// Prevent the shutdown
e.preventDefault();
// Disable media playback
mainWindow.webContents.send('set-media-playback-disabled', true);
// In certain cases such as during an active call, we ask the user to confirm close
// which includes shutdown, clicking X on MacOS or closing to tray.
let shouldClose = true;