Skip to content

Commit 88780a2

Browse files
committed
relocate all windows closed logic
1 parent f1b0e3b commit 88780a2

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/main-process/atom-application.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -454,15 +454,6 @@ module.exports = class AtomApplication extends EventEmitter {
454454
// Public: Removes the {AtomWindow} from the global window list.
455455
removeWindow(window) {
456456
this.windowStack.removeWindow(window);
457-
if (this.getAllWindows().length === 0) {
458-
if (this.applicationMenu != null) {
459-
this.applicationMenu.enableWindowSpecificItems(false);
460-
}
461-
if (['win32', 'linux'].includes(process.platform)) {
462-
app.quit();
463-
return;
464-
}
465-
}
466457
if (!window.isSpec) this.saveCurrentWindowOptions(true);
467458
}
468459

@@ -773,6 +764,18 @@ module.exports = class AtomApplication extends EventEmitter {
773764
})
774765
);
775766

767+
this.disposable.add(
768+
ipcHelpers.on(app, 'window-all-closed', () => {
769+
if (this.applicationMenu != null) {
770+
this.applicationMenu.enableWindowSpecificItems(false);
771+
}
772+
if (['win32', 'linux'].includes(process.platform)) {
773+
app.quit();
774+
return;
775+
}
776+
})
777+
);
778+
776779
// Triggered by the 'open-file' event from Electron:
777780
// https://electronjs.org/docs/api/app#event-open-file-macos
778781
// For example, this is fired when a file is dragged and dropped onto the Atom application icon in the dock.

0 commit comments

Comments
 (0)