import {BrowserWindow} from 'electron' import {info, window, splash} from '../../../configuration' if (process.env.NODE_ENV === "development") {var devTools = true} else if (process.env.NODE_ENV === 'production') {var devTools =false} let mainWindow : BrowserWindow const {TitlebarRespect} = require('electron-titlebar-respect') TitlebarRespect({ frameLinux: false }) module.exports = { launch: function() { mainWindow = new BrowserWindow({ title: info.name, width: window.width, height: window.height, minWidth: window.minWidth, minHeight: window.minHeight, show: false, autoHideMenuBar: true, transparent: true, frame: global.frame, titleBarStyle: global.titleBarStyle, vibrancy: 'sidebar', // Window blur effect on macOS backgroundMaterial: 'auto', // Window blur effect on Windows. Note: This method is only supported on Windows 11 22H2 and up. trafficLightPosition: { x: 25, y: 28 }, // Position of Traffic Light buttons on macOS titleBarOverlay: { // Background and Height of Windows titlebar buttons color: splash.backgroundColor, // Background symbolColor: 'white', // Icon height: 44, }, webPreferences: { webviewTag: true, nodeIntegration: false, contextIsolation: true, devTools: devTools } }) // Load Content if (process.env.NODE_ENV === "development") {mainWindow.loadURL('http://localhost:4321')} else if (process.env.NODE_ENV === 'production') {mainWindow.loadFile('.build/output/astro/index.html')} // Showing the window gracefuly // Doc: https://www.electronjs.org/docs/latest/api/browser-window#showing-the-window-gracefully mainWindow.once('ready-to-show', () => {mainWindow.show()}) } }