This repository was archived by the owner on Dec 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
98 lines (93 loc) · 2.73 KB
/
main.js
File metadata and controls
98 lines (93 loc) · 2.73 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
const electron = require('electron');
const { dialog, app, Menu } = require('electron');
const path = require('path');
const transparentBackground = false;
const iconPath = path.resolve(__dirname, 'Images', 'icon.png');
function createWindow() {
let window = new electron.BrowserWindow({
width: 800,
height: 600,
transparent: transparentBackground,
webPreferences: {
nodeIntegration: true
},
icon: iconPath
});
let menu = Menu.buildFromTemplate([
{
"label": "File",
"submenu": [
{
"label": "Open...",
click() {
//window.webContents.send('open-file');
dialog.showMessageBox(
null,
{
type: "info",
buttons: ["OK"],
title: "Open",
message: "Open file placeholder",
icon: iconPath
}
);
}
},
{
"label": "Close",
click() {
window.close();
}
}
]
},
{
"label": "Debug",
"submenu": [
{
"label": "DevTools",
click() {
window.webContents.toggleDevTools();
}
},
{
"label": "Reload",
click() {
window.reload();
}
}
]
},
{
"label": "Help",
"submenu": [
{
"label": "About",
click() {
//window.webContents.send('show-about');
dialog.showMessageBox(
null,
{
type: "info",
buttons: ["OK"],
title: "About",
message: "About program placeholder",
icon: iconPath
}
);
}
}
]
}
]);
Menu.setApplicationMenu(menu);
window.loadFile('index.html');
}
if (transparentBackground) {
electron.app.on('ready',
() => setTimeout(createWindow, 250)
);
}
else {
electron.app.on('ready', createWindow);
}