From c6d043b42c63f1b1fdff812acf2bd33eeee82d68 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 31 Aug 2024 23:08:19 +0300 Subject: [PATCH] electron: Fix crash on Linux --- src/services/window.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/services/window.ts b/src/services/window.ts index bc652d582..dd64aeb00 100644 --- a/src/services/window.ts +++ b/src/services/window.ts @@ -46,16 +46,18 @@ ipcMain.on('create-extra-window', (event, arg) => { }); async function createMainWindow(app: App) { - app.setUserTasks([ - { - program: process.execPath, - arguments: '--new-window', - iconPath: process.execPath, - iconIndex: 0, - title: 'Open New Window', - description: 'Open new window' - } - ]); + if ("setUserTasks" in app) { + app.setUserTasks([ + { + program: process.execPath, + arguments: '--new-window', + iconPath: process.execPath, + iconIndex: 0, + title: 'Open New Window', + description: 'Open new window' + } + ]); + } const windowStateKeeper = (await import('electron-window-state')).default; // should not be statically imported