-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
49 lines (41 loc) · 1.12 KB
/
index.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const path = require('path')
const {
app,
globalShortcut
} = require('electron')
const config = require('./server/config.js')
const router = require('./server/router.js')([
{ name: 'startup', only: true, path: path.join(__dirname, 'client/startup') },
{ name: 'applist', only: true, path: path.join(__dirname, 'client/applist') },
{ name: 'appedit', only: false, path: path.join(__dirname, 'client/appedit') }
])
const runner = require('./server/runner.js')()
app.on('ready', () => {
// init global api
global.epii = { router, runner }
// register global shortcut
var result = globalShortcut.register('Super+Enter', function () {
router.routeTo('startup')
})
if (!result) {
console.log('failed to register global shortcut')
}
// todo: register tray
if (process.platform === 'darwin') {
app.dock.hide()
}
// show startup view
router.routeTo('startup')
})
app.on('will-quit', function () {
globalShortcut.unregisterAll()
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
// only for macOS
app.on('activate', () => {
router.routeTo('startup')
})