1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-09-24 03:18:28 +02:00
upscayl/electron/main-window.ts

44 lines
1.0 KiB
TypeScript
Raw Normal View History

2023-09-10 19:42:18 +02:00
import { BrowserWindow, shell } from "electron";
2023-09-10 11:14:04 +02:00
import { getPlatform } from "./get-device-specs";
import { join } from "path";
import {
setCustomModelsFolderPath,
setFolderPath,
setImagePath,
setOutputFolderPath,
2023-09-10 19:42:18 +02:00
setOverwrite,
2023-09-10 11:14:04 +02:00
setQuality,
setSaveOutputFolder,
} from "./utils/config-variables";
2023-09-10 19:42:18 +02:00
import COMMAND from "./constants/commands";
import electronIsDev from "electron-is-dev";
2023-09-10 11:14:04 +02:00
2023-09-10 19:42:18 +02:00
let mainWindow: BrowserWindow | null;
2023-09-10 11:14:04 +02:00
2023-09-10 19:42:18 +02:00
const createMainWindow = () => {
mainWindow = new BrowserWindow({
icon: join(__dirname, "build", "icon.png"),
width: 1300,
height: 940,
minHeight: 500,
minWidth: 500,
show: false,
backgroundColor: "#171717",
webPreferences: {
nodeIntegration: true,
nodeIntegrationInWorker: true,
webSecurity: false,
preload: join(__dirname, "preload.js"),
},
titleBarStyle: getPlatform() === "mac" ? "hiddenInset" : "default",
});
2023-09-10 11:14:04 +02:00
2023-09-10 19:42:18 +02:00
mainWindow.setMenuBarVisibility(false);
};
const getMainWindow = () => {
return mainWindow;
};
2023-09-10 11:14:04 +02:00
2023-09-10 19:42:18 +02:00
export { createMainWindow, getMainWindow };