From d78a4ea394558a1a2475571ddef1f1fc769554ec Mon Sep 17 00:00:00 2001 From: TheGoddessInari Date: Sat, 2 May 2020 16:38:47 -0700 Subject: [PATCH] Don't unconditionally enable/disable auto_launch. --- electron/main.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/electron/main.js b/electron/main.js index 42b4b7fa..c362fe5a 100644 --- a/electron/main.js +++ b/electron/main.js @@ -74,11 +74,20 @@ const appLauncher = new AutoLaunch({ name: 'Hamsket' ,isHidden: config.get('start_minimized') }); -if (config.get('auto_launch') && !isDev) { - appLauncher.enable(); -} -else { - appLauncher.disable(); +if (!isDev) { + appLauncher + .isEnabled() + .then((isEnabled) => { + if (config.get('auto_launch') && !isEnabled) { + appLauncher.enable(); + } else if (!config.get('auto_launch') && isEnabled) { + appLauncher.disable(); + } + return; + }) + .catch((err) => { + console.log(err); + }); } // Keep a global reference of the window object, if you don't, the window will