|
@@ -27,14 +27,14 @@ class AutoLauncher {
|
|
}
|
|
}
|
|
|
|
|
|
async toggleAutoLaunch() {
|
|
async toggleAutoLaunch() {
|
|
- const isEnabled = await this.isEnabled();
|
|
|
|
|
|
+ const wasEnabled = await this.isEnabled();
|
|
const autoLaunch = this.autoLaunch;
|
|
const autoLaunch = this.autoLaunch;
|
|
if (autoLaunch) {
|
|
if (autoLaunch) {
|
|
- if (isEnabled) await autoLaunch.disable();
|
|
|
|
|
|
+ if (wasEnabled) await autoLaunch.disable();
|
|
else await autoLaunch.enable();
|
|
else await autoLaunch.enable();
|
|
} else {
|
|
} else {
|
|
- if (isEnabled) app.setLoginItemSettings({ openAtLogin: false });
|
|
|
|
- else app.setLoginItemSettings({ openAtLogin: true });
|
|
|
|
|
|
+ const openAtLogin = !wasEnabled;
|
|
|
|
+ app.setLoginItemSettings({ openAtLogin });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -42,8 +42,7 @@ class AutoLauncher {
|
|
if (this.autoLaunch) {
|
|
if (this.autoLaunch) {
|
|
return app.commandLine.hasSwitch("hidden");
|
|
return app.commandLine.hasSwitch("hidden");
|
|
} else {
|
|
} else {
|
|
- // TODO(MR): This apparently doesn't work anymore.
|
|
|
|
- return app.getLoginItemSettings().wasOpenedAtLogin;
|
|
|
|
|
|
+ return app.getLoginItemSettings().openAtLogin;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|