Permalink
Browse files

fix(Windows): Fix enable/disable autostart on login

Fixes #17
  • Loading branch information...
adlk committed Oct 23, 2017
1 parent 8e3dcd4 commit eca7f3bccb10b30b651b0851a8b4f28da64d2c98
Showing with 15 additions and 12 deletions.
  1. +15 −12 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');
}

0 comments on commit eca7f3b

Please sign in to comment.