From 99cec1316a09aba2736810c6f8998dfe2d47ca8c Mon Sep 17 00:00:00 2001 From: Kylart Date: Wed, 6 Sep 2017 21:16:45 +0200 Subject: [PATCH] Fix Tray for other platform than Mac --- main.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index 481311f..edad4c4 100644 --- a/main.js +++ b/main.js @@ -200,6 +200,9 @@ const newWin = () => { })) } + process.win = win + process.appURL = _APP_URL_ + pollServer() } @@ -207,7 +210,9 @@ Electron.on('ready', () => { Menu.setApplicationMenu(menu) if (localConfig.system.toTray) { - Electron.dock.hide() + if (process.platform === 'darwin') { + Electron.dock.hide() + } tray = new Tray(path.join(__dirname, 'static', 'images', 'tray.png')) const contextMenu = Menu.buildFromTemplate([ {label: 'New window', click: () => { win === null && newWin() }, accelerator: 'CommandOrControl+N'}, @@ -220,9 +225,6 @@ Electron.on('ready', () => { } newWin() - - process.win = win - process.appURL = _APP_URL_ }) // Quit when all windows are closed. @@ -230,8 +232,10 @@ Electron.on('window-all-closed', function () { // On OS X it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q if (process.platform !== 'darwin') { - server.close() - Electron.quit() + if (!tray) { + server.close() + Electron.quit() + } } })