-
Notifications
You must be signed in to change notification settings - Fork 10
/
main.js
executable file
·47 lines (37 loc) · 1.2 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
39
40
41
42
43
44
45
46
47
const electron = require('electron')
const app = electron.app
const gotLock = app.requestSingleInstanceLock()
if (!gotLock) {
app.exit(0)
return;
}
const windowProvider = require('./resources/js/window-provider.js')
const menu = require('./resources/js/menu.js')
app.on('second-instance', () => {
windowProvider.getWindow().show()
})
app.setAppUserModelId("xyz.klinker.support")
app.on('ready', createWindow)
app.on('activate', createWindow)
app.on('window-all-closed', () => {
// used to close the app and the web socket here for non-macOS devices
// We don't want to do that anymore, since we are able to save and restore
// the app state.
})
app.on('before-quit', () => {
app.exit(0)
})
app.userAgentFallback = app.userAgentFallback = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36'
function createWindow() {
if (windowProvider.getWindow() == null) {
let window = windowProvider.createMainWindow()
menu.buildMenu(windowProvider)
} else {
if (process.platform === 'darwin') {
app.dock.show()
}
let window = windowProvider.getWindow()
window.show()
menu.buildMenu(windowProvider)
}
}