Skip to content

Commit eca7f3b

Browse files
committed
fix(Windows): Fix enable/disable autostart on login
Fixes #17
1 parent 8e3dcd4 commit eca7f3b

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/stores/AppStore.js

+15-12
Original file line numberDiff line numberDiff line change
@@ -173,24 +173,27 @@ export default class AppStore extends Store {
173173
@action _launchOnStartup({ enable, openInBackground }) {
174174
this.autoLaunchOnStart = enable;
175175

176-
const settings = {
176+
let settings = {
177177
openAtLogin: enable,
178-
openAsHidden: openInBackground,
179-
path: updateExe,
180-
args: [
181-
'--processStart', `"${exeName}"`,
182-
],
183178
};
184179

185180
// For Windows
186-
if (openInBackground) {
187-
settings.args.push(
188-
'--process-start-args', '"--hidden"',
189-
);
181+
if (process.platform === 'win32') {
182+
settings = Object.assign({
183+
openAsHidden: openInBackground,
184+
path: updateExe,
185+
args: [
186+
'--processStart', `"${exeName}"`,
187+
],
188+
}, settings);
189+
190+
if (openInBackground) {
191+
settings.args.push(
192+
'--process-start-args', '"--hidden"',
193+
);
194+
}
190195
}
191196

192-
app.setLoginItemSettings(settings);
193-
194197
gaEvent('App', enable ? 'enable autostart' : 'disable autostart');
195198
}
196199

0 commit comments

Comments
 (0)