Skip to content

Commit ac66404

Browse files
Intercepteded close event for hidding bg console instead of killing it (requestly#301)
1 parent 9fd67d7 commit ac66404

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/main/actions/cleanup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const cleanup = () => {
1616

1717
export const getReadyToQuitApp = async () => {
1818
return new Promise((resolve) => {
19+
global.isQuitting = true;
1920
cleanup();
2021

2122
if (global.backgroundWindow) {

src/main/actions/startBackgroundProcess.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ const startBackgroundProcess = async () => {
6868
backgroundWindow.webContents.openDevTools();
6969
})
7070
}
71+
72+
backgroundWindow.on('close', (event) => {
73+
if (!global.isQuitting) {
74+
event.preventDefault();
75+
backgroundWindow.hide();
76+
}
77+
return false;
78+
});
7179

7280
// Setup IPC forwarding
7381
setupIPCForwardingToBackground(backgroundWindow);

src/main/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ const createWindow = async () => {
335335
globalAny.backgroundWindow.show();
336336

337337
// eslint-disable-next-line
338-
globalAny.backgroundWindow.webContents.toggleDevTools();
338+
globalAny.backgroundWindow.webContents.openDevTools();
339339
}
340340
} catch (error) {
341341
console.error(error);

0 commit comments

Comments
 (0)