Skip to content

Commit

Permalink
fix(Windows): Fix enable/disable autostart on login
Browse files Browse the repository at this point in the history
Fixes #17
  • Loading branch information
adlk committed Oct 23, 2017
1 parent 8e3dcd4 commit eca7f3b
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/stores/AppStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down

0 comments on commit eca7f3b

Please sign in to comment.