-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
48 lines (41 loc) · 1.39 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
const electron = require('electron');
const { app, BrowserWindow, ipcMain } = electron;
let mainWindow = null;
let sideWindows = [];
app.once('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.once('ready', () => {
mainWindow = new BrowserWindow({
fullscreen: true,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
}
});
mainWindow.loadURL('file://' + __dirname + '/index.html');
mainWindow.setMenu(null);
// mainWindow.webContents.openDevTools();
mainWindow.on('closed', () => mainWindow = null);
const externalDisplays = electron.screen.getAllDisplays()
.filter((display) => display.bounds.x !== 0 || display.bounds.y !== 0);
externalDisplays.forEach((externalDisplay) => {
const win = new BrowserWindow({
x: externalDisplay.bounds.x,
y: externalDisplay.bounds.y,
width: externalDisplay.bounds.width,
height: externalDisplay.bounds.height,
fullscreen: true
});
const index = sideWindows.push(win) - 1;
win.loadURL('file://' + __dirname + '/black.html');
win.setMenu(null);
win.on('closed', () => {
sideWindows[index] = null;
});
});
});
ipcMain.on('terminate', () => app.quit());