-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
38 lines (32 loc) · 1 KB
/
main.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
import { app, Tray, Menu } from 'electron'
import path from 'path'
import { windowConfig, trayTemplate } from './app/config/constants'
import { unregisterHotkeys } from './app/utils/setup'
import { EntryWindowManager } from './app/utils/window'
let ewManager
let tray
const indexPath = path.join(__dirname,'app/index.html')
const trayIcon = path.join(__dirname,'app/static/trayIcon.png')
app.on('ready',() => {
app.dock.hide()
ewManager = new EntryWindowManager(windowConfig,indexPath)
ewManager.win.webContents.openDevTools({mode:'undocked'})
tray = new Tray(trayIcon)
const contextMenu = Menu.buildFromTemplate(trayTemplate)
tray.setToolTip('Quickly.do')
tray.setContextMenu(contextMenu)
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin'){
app.quit()
}
})
app.on('activate', () => {
if (!ewManager.win) {
ewManager = new EntryWindowManager(windowConfig,indexPath)
}
})
app.on('will-quit', () => {
//NOTE: Don't know how necessary this is
unregisterHotkeys()
})