| | |
| | | "use strict"; |
| | | const { app, BrowserWindow, screen } = require("electron"); |
| | | const { app, BrowserWindow, screen, globalShortcut, ipcMain } = require("electron"); |
| | | const { join } = require("path"); |
| | | process.env["ELECTRON_DISABLE_SECURITY_WARNINGS"] = "true"; |
| | | const createWindow = () => { |
| | | const { width, height } = screen.getPrimaryDisplay().bounds; |
| | | const createWindow = (width, height) => { |
| | | const win = new BrowserWindow({ |
| | | width, |
| | | height, |
| | | minWidth: 1280, |
| | | minHeight: 720 |
| | | minHeight: 720, |
| | | webPreferences: { |
| | | preload: join(__dirname, "preload.js") |
| | | } |
| | | }); |
| | | win.maximize(); |
| | | if (process.env.VITE_DEV_SERVER_URL) { |
| | | win.loadURL(process.env.VITE_DEV_SERVER_URL); |
| | | win.webContents.openDevTools(); |
| | |
| | | } |
| | | }; |
| | | app.whenReady().then(() => { |
| | | createWindow(); |
| | | const { width, height } = screen.getPrimaryDisplay().bounds; |
| | | createWindow(width, height); |
| | | app.on("activate", () => { |
| | | if (BrowserWindow.getAllWindows().length === 0) |
| | | createWindow(); |
| | | }); |
| | | ipcMain.on("open-new-window", () => { |
| | | const childWin = new BrowserWindow({ |
| | | width, |
| | | height, |
| | | minWidth: width, |
| | | minHeight: height, |
| | | webPreferences: { |
| | | preload: join(__dirname, "preload.js") |
| | | } |
| | | }); |
| | | childWin.maximize(); |
| | | if (process.env.VITE_DEV_SERVER_URL) { |
| | | childWin.loadURL(process.env.VITE_DEV_SERVER_URL + "#/meet"); |
| | | } else { |
| | | childWin.loadFile(join(__dirname, "../dist/index.html"), { |
| | | hash: "/meet" |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | app.on("window-all-closed", () => { |
| | | if (process.platform !== "darwin") |