-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
41 lines (34 loc) · 858 Bytes
/
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
const { app, BrowserWindow, globalShortcut, shell } = require('electron')
const createWindow = () => {
const win = new BrowserWindow({
minWidth: 1200,
minHeight: 600,
autoHideMenuBar: true,
title: 'DevDocs',
})
win.loadURL('https://devdocs.io')
return win
}
app.whenReady().then(() => {
const window = createWindow()
// New tab requests go to default browser
window.webContents.setWindowOpenHandler(({ url }) => {
shell.openExternal(url);
return { action: 'deny' }
});
globalShortcut.register('Alt+Space', () => {
if (window.isFocused()) {
window.hide()
} else {
// if (window.isMinimized()) window.restore()
if (window.isVisible()) {
window.focus()
} else {
window.show()
}
}
})
});
app.on('will-quit', () => {
globalShortcut.unregisterAll();
})