Auto-start for Linux

This commit is contained in:
Scott E. Graves
2018-10-03 22:05:34 -05:00
parent b5171f2b1b
commit 4e5cf652c9

View File

@@ -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();
});
}
}