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