forked from hundredrabbits/Donsol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
61 lines (47 loc) · 1.16 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
60
61
const {app, BrowserWindow, webFrame, Menu} = require('electron')
const path = require('path')
const url = require('url')
const shell = require('electron').shell;
let win
let is_shown = true;
app.inspect = function()
{
app.win.toggleDevTools();
}
app.toggle_fullscreen = function()
{
app.win.setFullScreen(app.win.isFullScreen() ? false : true);
}
app.toggle_visible = function()
{
if(is_shown){ app.win.hide(); } else{ app.win.show(); }
}
app.inject_menu = function(m)
{
Menu.setApplicationMenu(Menu.buildFromTemplate(m));
}
app.win = null;
app.on('ready', () =>
{
app.win = new BrowserWindow({width: 960, height: 450, minWidth:860, minHeight:450, frame:false, autoHideMenuBar: true,backgroundColor: '#000000', resizable:true, autoHideMenuBar: true,icon: __dirname + '/icon.ico'})
app.win.loadURL(`file://${__dirname}/sources/index.html`)
app.win.on('closed', () => {
win = null
app.quit()
})
app.win.on('hide',function() {
is_shown = false;
})
app.win.on('show',function() {
is_shown = true;
})
})
app.on('window-all-closed', () =>
{
app.quit()
})
app.on('activate', () => {
if (app.win === null) {
createWindow()
}
})