forked from klaudiosinani/tusk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
startup.js
35 lines (30 loc) · 738 Bytes
/
startup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'use strict';
const electron = require('electron');
const AutoLaunch = require('auto-launch');
const app = electron.app;
const launchTusk = new AutoLaunch({
name: 'Tusk',
path: (process.platform === 'darwin') ? app.getPath('exe').replace(/\.app\/Content.*/, '.app') : undefined,
isHidden: true
});
function activate() {
// Activate app launch on login
return launchTusk
.isEnabled()
.then(enabled => {
if (!enabled) {
return launchTusk.enable();
}
});
}
function deactivate() {
// Deactivate app launch on login
return launchTusk
.isEnabled()
.then(enabled => {
if (enabled) {
return launchTusk.disable();
}
});
}
module.exports = {activate, deactivate};