2023-08-30 02:11:27 -05:00
|
|
|
import {BrowserWindow} from 'electron'
|
|
|
|
import {info, window, splash} from '../../../configuration'
|
2023-08-30 15:17:22 -05:00
|
|
|
|
2023-08-30 02:11:27 -05:00
|
|
|
if (process.env.NODE_ENV === "development") {var devTools = true}
|
|
|
|
else if (process.env.NODE_ENV === 'production') {var devTools =false}
|
2023-08-30 15:17:22 -05:00
|
|
|
|
2023-08-30 02:11:27 -05:00
|
|
|
let mainWindow : BrowserWindow
|
|
|
|
|
2023-08-30 15:17:22 -05:00
|
|
|
const {TitlebarRespect} = require('electron-titlebar-respect')
|
2023-09-10 04:31:31 -05:00
|
|
|
TitlebarRespect({
|
|
|
|
frameLinux: false
|
|
|
|
})
|
2023-08-30 15:17:22 -05:00
|
|
|
|
2023-08-30 02:11:27 -05:00
|
|
|
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,
|
2023-08-30 15:17:22 -05:00
|
|
|
frame: global.frame,
|
|
|
|
titleBarStyle: global.titleBarStyle,
|
2023-08-30 02:11:27 -05:00
|
|
|
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
|
2023-09-09 19:01:57 -05:00
|
|
|
if (process.env.NODE_ENV === "development") {mainWindow.loadURL('http://localhost:4321')}
|
2023-08-30 02:11:27 -05:00
|
|
|
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()})
|
|
|
|
}
|
|
|
|
}
|