Skip to content

Commit

Permalink
window-all-closed fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nbonamy committed Oct 28, 2024
1 parent a8045f7 commit 52a69ce
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/windows/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { strDict } from '../../types/index.d';
import { CreateWindowOpts } from '../../types/window.d';
import { app, BrowserWindow, BrowserWindowConstructorOptions, Menu, nativeTheme, screen, shell } from 'electron';
import { promptAnywhereWindow } from './anywhere';
import { mainWindow } from './main';
import * as config from '../config';
import { wait } from '../utils';
Expand Down Expand Up @@ -79,6 +80,15 @@ export const createWindow = (opts: CreateWindowOpts = {}) => {
}
});

// we keep prompt anywhere all the time so we need our own way
window.on('closed', () => {
const windows = BrowserWindow.getAllWindows();
console.log(windows.length);
if (windows.length === 1 && windows[0] === promptAnywhereWindow) {
app.emit('window-all-closed');
}
});

// web console to here
window.webContents.on('console-message', (event, level, message, line, sourceId) => {
if (!message.includes('Electron Security Warning') && !message.includes('Third-party cookie will be blocked')) {
Expand Down

0 comments on commit 52a69ce

Please sign in to comment.