1
Fork 0
This repository has been archived on 2024-05-27. You can view files and clone it, but cannot push or open issues or pull requests.
Nexus-Polestar/app/electron/main/window.ts

43 lines
1.9 KiB
TypeScript
Raw Normal View History

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
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: false,
// titleBarStyle: 'hiddenInset',
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:2023')}
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()})
}
}