Skip to content
This repository has been archived by the owner on Nov 19, 2022. It is now read-only.

Commit

Permalink
added the autolaunch in startup feature
Browse files Browse the repository at this point in the history
  • Loading branch information
netharuM committed Feb 7, 2022
1 parent 2cbd909 commit 298e3c6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,19 @@ class settingsConfig extends JSON_Config {
super(pathToConfig);
this.config = {
runInBackgroundWhenClosed: true,
autoLaunchInStartup: false,
};
this.readConfig();
}

getAutoLaunchInStartup() {
return this.getKeyValue("autoLaunchInStartup");
}

setAutoLaunchInStartup(value) {
this.setKey("autoLaunchInStartup", value);
}

setBackgroundWhenClosed(value) {
this.setKey("runInBackgroundWhenClosed", value);
}
Expand Down
7 changes: 7 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ ipcMain.on("get_rbw_closed", (e, arg) => {

ipcMain.on("start-on-startup", (event, arg) => {
if (arg) {
settingsFile.setAutoLaunchInStartup(true);
autolaunch.enable();
} else {
settingsFile.setAutoLaunchInStartup(false);
autolaunch.disable();
}
});
Expand All @@ -61,6 +63,11 @@ let autolaunch = new autoLaunch({
name: "auto-bell",
path: app.getPath("exe"),
});
if (settingsFile.getAutoLaunchInStartup()) {
autolaunch.enable();
} else {
autolaunch.disable();
}
const createWindow = () => {
if (!gotTheLock) {
app.quit();
Expand Down

0 comments on commit 298e3c6

Please sign in to comment.