Live video on the AT Protocol
1import { BrowserWindow, globalShortcut } from "electron";
2import { resolve } from "path";
3import getEnv, { MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY } from "./env";
4
5export const makeWindow = async (): Promise<BrowserWindow> => {
6 const { isDev } = getEnv();
7 let logoFile: string;
8 if (isDev) {
9 // theoretically cwd is streamplace/js/desktop:
10 logoFile = resolve(process.cwd(), "assets", "streamplace-logo.png");
11 } else {
12 logoFile = resolve(process.resourcesPath, "streamplace-logo.png");
13 }
14 const window = new BrowserWindow({
15 height: 600,
16 width: 800,
17 icon: logoFile,
18 webPreferences: {
19 preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY,
20 },
21 // titleBarStyle: "hidden",
22 // titleBarOverlay: true,
23 });
24
25 globalShortcut.register("CommandOrControl+Shift+I", () => {
26 window.webContents.toggleDevTools();
27 });
28
29 globalShortcut.register("CommandOrControl+Shift+R", () => {
30 window.webContents.reload();
31 });
32
33 window.removeMenu();
34
35 return window;
36};