/
main.js
executable file
·59 lines (45 loc) · 1.36 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
57
58
59
'use strict';
var electron = require('electron');
var app = electron.app;
var BrowserWindow = electron.BrowserWindow;
const ipcMain = require('electron').ipcMain;
var fs = require('fs');
const Tray = electron.Tray;
const Menu = electron.Menu;
var mainWindow = null;
let appIcon = null;
app.on('window-all-closed', function() {
if (process.platform != 'darwin') {
app.quit();
}
});
app.on('ready', function() {
mainWindow = new BrowserWindow({
width: 1200,
height: 800,
minWidth: 500,
minHeight: 300
});
mainWindow.setMenu(null);
mainWindow.loadURL('file://' + __dirname + '/index.html');
// appIcon = new Tray(__dirname + '/icon/vk-16-b.png');
// let contextMenu = Menu.buildFromTemplate([
// { label: 'Open vk-chat', click: () => { mainWindow.show() }},
// { label: 'Minimize to tray', click: () => { mainWindow.minimize() }},
// { label: 'Quit', click: () => { app.quit() }}
// ]);
// appIcon.setToolTip('vk chat');
// appIcon.setContextMenu(contextMenu);
//
// appIcon.on('right-click', function(event, bounds) {
// if (mainWindow.isVisible()) {
// mainWindow.minimize();
// } else {
// mainWindow.show();
// }
// })
mainWindow.webContents.openDevTools();
mainWindow.on('closed', function() {
mainWindow = null;
});
});