This repository was archived by the owner on Nov 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
83 lines (75 loc) · 1.95 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
Under the MIT lisense
**/
const { app, nativeTheme, ipcMain, BrowserWindow } = require("electron");
const path = require("path");
let win = undefined;
let registerWin = undefined;
function createWindow() {
win = new BrowserWindow({
width: 1024,
height: 780,
icon: "html/img/ddc.png",
webPreferences: {
nodeIntegration: true
}
});
win.setMenuBarVisibility(false);
win.loadFile("html/index.html");
win.webContents.on("did-finish-load", function() {
win.webContents.send("change-dark-theme", nativeTheme.shouldUseDarkColors);
});
console.log("Main Menu Launched.")
}
function createErrorWindow() {
win = new BrowserWindow({
width: 1024,
height: 780,
icon: "html/img/ddc.png",
webPreferences: {
nodeIntegration: true
}
});
win.setMenuBarVisibility(false);
win.loadFile("html/index.html");
win.webContents.on("did-finish-load", function() {
win.webContents.send("change-dark-theme", nativeTheme.shouldUseDarkColors);
});
console.log("Main Menu Launched.")
}
// ipcMain.on("failed-to-launch", function() {
// registerWin = new BrowserWindow({
// width: 300,
// height: 50,
// icon: "html/img/ddc.png",
// webPreferences: {
// nodeIntegration: true
// }
// });
// registerWin.setMenuBarVisibility(false);
// registerWin.loadFile("html/index.html");
// registerWin.webContents.on("did-finish-load", function() {
// registerWin.webContents.send("change-dark-theme", nativeTheme.shouldUseDarkColors);
// });
// console.log("Failed Menu Launched.")
// });
function main() {
createWindow();
}
app.whenReady().then(main);
app.on("window-all-closed", function() {
if (process.platform !== "darwin") {
app.quit();
}
});
app.on("activate", function() {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
nativeTheme.on("updated", function() {
win.webContents.send("change-dark-theme", nativeTheme.shouldUseDarkColors);
});
ipcMain.on("close-register-window", function() {
registerWin.close();
});