-
Notifications
You must be signed in to change notification settings - Fork 11
/
main.js
56 lines (46 loc) · 1.42 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
48
49
50
51
52
53
54
55
56
const {app, BrowserWindow, Menu, Tray} = require('electron')
const appMenuTemplate = require('./electron/app-menu-template');
const path = require('path')
const iconIdle = path.join(__dirname, 'icos', '16x16.png');
const isDarwin = process.platform === 'darwin';
const isLinux = process.platform === 'linux';
const isWindows = process.platform === 'win32';
let keepWindow
const createWindow = () => {
let initWindow = () => {
keepWindow = new BrowserWindow({
'width': 999,
'minWidth': 999,
'height': 666,
'minHeight': 666,
//'resizable': false,
'title': 'Keep',
'center': true,
'titleBarStyle': 'hidden',
'zoomToPageWidth': true,
'frame': false,
'show': false
})
keepWindow.loadURL(`file://${__dirname}/app/index.html`)
//keepWindow.webContents.openDevTools()
keepWindow.webContents.on('did-finish-load', function () {
keepWindow.show();
})
keepWindow.on('close', (e) => {
keepWindow = null
})
const menu = Menu.buildFromTemplate(appMenuTemplate);
Menu.setApplicationMenu(menu);
}
initWindow();
};
app.on('ready', createWindow)
app.on('window-all-closed', () => {
if (!isDarwin) {
app.quit()
}
})
app.on('activate', () => {
if (keepWindow) createWindow()
keepWindow.show()
})