From 6d97ebb7a78486dc1cb45ed2e18ffb099a062fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bouget?= Date: Tue, 2 Jul 2024 17:13:31 +0200 Subject: [PATCH] #183 fix double click on mac --- app/main.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/main.ts b/app/main.ts index c715f96..d8125d8 100644 --- a/app/main.ts +++ b/app/main.ts @@ -46,7 +46,14 @@ app.on('will-finish-launching', function () { if (win) { setTimeout(() => { win.webContents.send('file-open-system', fileToLoad); - }, 500); + }, 2500); + } else { + // if win is not ready, wait for it + app.once('browser-window-created', () => { + setTimeout(() => { + win.webContents.send('file-open-system', fileToLoad); + }, 2500); + }); } } }); @@ -100,13 +107,6 @@ function createWindow(): BrowserWindow { win.loadURL(url.href); } - // Traiter le fichier ouvert après que la fenêtre soit prête - if (fileToLoad) { - win.webContents.on('did-finish-load', () => { - win.webContents.send('open-file', fileToLoad); - }); - } - // Emitted when the window is closed. win.on('closed', () => { // Dereference the window object, usually you would store window