const { app, BrowserWindow, session, globalShortcut } = require("electron"); const path = require("path"); class Main { constructor() { const { width, height } = require("electron").screen.getPrimaryDisplay().workAreaSize; this.win = new BrowserWindow({ title: "Control", backgroundColor: "#520000", x: width / 2, y: 0, width: width / 2, height: height, resizable: true, frame: false, show: false, webPreferences: { webSecurity: false } }); if (process.env.NODE_ENV == "production") this.win.loadURL(`file://${__dirname}/dist/index.html`); else if (process.env.NODE_ENV == "development"){ this.win.loadURL("http://localhost:4200"); this.win.webContents.openDevTools(); } this.win.once("ready-to-show", () => { this.win.show(); }); // Open the DevTools. globalShortcut.register("commandOrControl+shift+c", () => { this.win.webContents.openDevTools(); }); globalShortcut.register("commandOrControl+shift+r", () => { this.win.webContents.reload(); }); } } app.on("ready", () => { new Main(); });