From eca7f3bccb10b30b651b0851a8b4f28da64d2c98 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Mon, 23 Oct 2017 16:31:25 +0200 Subject: [PATCH] fix(Windows): Fix enable/disable autostart on login Fixes #17 --- src/stores/AppStore.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index 42ec25204..28fe14049 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js @@ -173,24 +173,27 @@ export default class AppStore extends Store { @action _launchOnStartup({ enable, openInBackground }) { this.autoLaunchOnStart = enable; - const settings = { + let settings = { openAtLogin: enable, - openAsHidden: openInBackground, - path: updateExe, - args: [ - '--processStart', `"${exeName}"`, - ], }; // For Windows - if (openInBackground) { - settings.args.push( - '--process-start-args', '"--hidden"', - ); + if (process.platform === 'win32') { + settings = Object.assign({ + openAsHidden: openInBackground, + path: updateExe, + args: [ + '--processStart', `"${exeName}"`, + ], + }, settings); + + if (openInBackground) { + settings.args.push( + '--process-start-args', '"--hidden"', + ); + } } - app.setLoginItemSettings(settings); - gaEvent('App', enable ? 'enable autostart' : 'disable autostart'); }