From 4e5cf652c94bbf222559cf2b70e5ce11ab8df7ce Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Wed, 3 Oct 2018 22:05:34 -0500 Subject: [PATCH] Auto-start for Linux --- electron.js | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/electron.js b/electron.js index 3d8d809..fdee93f 100644 --- a/electron.js +++ b/electron.js @@ -48,10 +48,14 @@ function createWindow() { mainWindow = null }); - if (os.platform() === 'win32') { + if ((os.platform() === 'win32') || (os.platform() === 'linux')) { + const appPath = (os.platform() === 'win32') ? + path.resolve(path.join(app.getAppPath(), '..\\..\\repertory-ui.exe')) : + process.env.APPIMAGE; + const autoLauncher = new AutoLaunch({ name: 'Repertory UI', - path: path.resolve(path.join(app.getAppPath(), '..\\..\\repertory-ui.exe')), + path: appPath, }); const image = nativeImage.createFromPath(path.join(__dirname, '/build/logo.png')); @@ -89,17 +93,18 @@ function createWindow() { ]); mainContextWindow.items[0].checked = true; - autoLauncher.isEnabled() - .then((enabled) => { - mainContextWindow.items[1].checked = enabled; + autoLauncher + .isEnabled() + .then((enabled) => { + mainContextWindow.items[1].checked = enabled; - mainWindowTray = new Tray(image); - mainWindowTray.setToolTip('Repertory UI'); - mainWindowTray.setContextMenu(mainContextWindow) - }) - .catch(() => { - app.quit(); - }); + mainWindowTray = new Tray(image); + mainWindowTray.setToolTip('Repertory UI'); + mainWindowTray.setContextMenu(mainContextWindow) + }) + .catch(() => { + app.quit(); + }); } }