Skip to content

Commit

Permalink
moved autolauncher to SaveStates()
Browse files Browse the repository at this point in the history
  • Loading branch information
erik-404err authored Jan 5, 2021
1 parent cb434dd commit 3164cb2
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,21 +318,9 @@ app.whenReady().then(createWindow).then(StartNotification).then(() => {
}
tray.setContextMenu(contextMenu); //setting contextMenu
tray.setToolTip(GetToolTip()); //get the text shown when hovering over the TrayIcon
let autolauncher = new AutoLaunch({ //create an auto launcher
var autolauncher = new AutoLaunch({ //create an auto launcher
name: 'SnapdropTray' //no path needs to be specyfied; https://github.com/Teamwork/node-auto-launch/issues/99 -> this is why productName='SnapdropTray' and not 'Snapdrop Tray'
});

autolauncher.isEnabled().then(function(isEnabled){//lookup if autostart already is enabled
if(GetAutoLauncheckboxState()){
if(!isEnabled){ //if it should but it isnt
autolauncher.enable(); //enable
};
} else {
if(isEnabled){ //if it shouldn't but it is
autolauncher.disable(); //disable
};
};
});
});
//END

Expand All @@ -354,6 +342,9 @@ function SaveStates(){
store.set('UsingWindow', contextMenu.commandsMap[contextMenu.getMenuItemById('checkboxes').commandId].submenu.commandsMap[contextMenu.getMenuItemById('window').commandId].checked );
store.set('UsingFrame', contextMenu.commandsMap[contextMenu.getMenuItemById('checkboxes').commandId].submenu.commandsMap[contextMenu.getMenuItemById('frame').commandId].checked );
//en/disable autolauncher
var autolauncher = new AutoLaunch({ //create an auto launcher
name: 'SnapdropTray' //no path needs to be specyfied; https://github.com/Teamwork/node-auto-launch/issues/99 -> this is why productName='SnapdropTray' and not 'Snapdrop Tray'
});
autolauncher.isEnabled().then(function(isEnabled){if(GetAutoLauncheckboxState()){if(!isEnabled){autolauncher.enable();};} else {if(isEnabled){autolauncher.disable();};};});
};
//END

0 comments on commit 3164cb2

Please sign in to comment.