-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
executable file
·86 lines (74 loc) · 2.24 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
84
85
86
const { app, BrowserWindow, ipcMain, Menu, shell } = require("electron");
const windowStateKeeper = require("electron-window-state");
require("@electron/remote/main").initialize();
ipcMain.on( "closeappcompletely", ( event ) => {
app.quit();
} );
ipcMain.on("hardreboot", function(e) {
app.relaunch();
app.quit();
});
ipcMain.on("openSettings", function(e) {
var win = new BrowserWindow({
height: 500,
width: 400,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false,
}
});
win.loadFile("window/settings.html");
win.setMenuBarVisibility(false);
require("@electron/remote/main").enable(win.webContents);
});
ipcMain.on("openSplitEditor", function(e) {
var win = new BrowserWindow({
height: 500,
width: 400,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false,
}
});
win.loadFile("window/splitsmanager/editsplits.html");
win.setMenuBarVisibility(false);
require("@electron/remote/main").enable(win.webContents);
});
function createWindow () {
let mainWindowState = windowStateKeeper({
defaultWidth: 250,
defaultHeight: 400
});
var mainWindow = new BrowserWindow({
x: mainWindowState.x,
y: mainWindowState.y,
width: mainWindowState.width,
height: mainWindowState.height,
frame: false,
//resizable: false,
transparent: true,
alwaysOnTop: true,
fullscreenable: false,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false,
},
icon: "window/icon.png",
});
require("@electron/remote/main").enable(mainWindow.webContents);
mainWindowState.manage(mainWindow);
mainWindow.loadFile("window/index.html");
ipcMain.on( "softreboot", ( event ) => {
mainWindow.loadFile("window/index.html")
} );
}
app.whenReady().then(() => {
createWindow();
app.on("activate", function () {
if (BrowserWindow.getAllWindows().length == 0) createWindow();
});
});
app.allowRendererProcessReuse = false;