Pref: start automatically on login

This commit is contained in:
Noam Okman
2016-09-02 15:47:03 +03:00
committed by DC
parent 3a4906079b
commit 3e85289318
9 changed files with 83 additions and 6 deletions

27
src/main/startup.js Normal file
View File

@@ -0,0 +1,27 @@
module.exports = {
install,
uninstall
}
const config = require('../config')
const AutoLaunch = require('auto-launch')
const appLauncher = new AutoLaunch({
name: config.APP_NAME,
isHidden: true
})
function install () {
return appLauncher.isEnabled()
.then(enabled => {
if (enabled) return
return appLauncher.enable()
})
}
function uninstall () {
return appLauncher.isEnabled()
.then(enabled => {
if (enabled) return appLauncher.disable()
})
}