54 lines
1.9 KiB
JavaScript
54 lines
1.9 KiB
JavaScript
|
const {BrowserWindow} = require('electron')
|
||
|
const glasstron = require('glasstron-clarity') // By SudoVanilla
|
||
|
const path = require('path')
|
||
|
const {TitlebarRespect} = require('electron-titlebar-respect') // By SudoVanilla
|
||
|
|
||
|
let AppMenu = require('./menu')
|
||
|
let Notification = require('./notifications')
|
||
|
let Platform = require('./platform')
|
||
|
|
||
|
TitlebarRespect({})
|
||
|
|
||
|
module.exports = {
|
||
|
Create: function() {
|
||
|
mainWindow = new glasstron.BrowserWindow({
|
||
|
title: process.env.Name,
|
||
|
minWidth: 400,
|
||
|
minHeight: 400,
|
||
|
width: 1200,
|
||
|
height: 800,
|
||
|
autoHideMenuBar: true,
|
||
|
show: false,
|
||
|
blur: true,
|
||
|
frame: global.frame,
|
||
|
titleBarStyle: global.titleBarStyle,
|
||
|
icon: global.AppIcon,
|
||
|
trafficLightPosition: { x: 25, y: 25 }, // Position of Traffic Light buttons on macOS
|
||
|
titleBarOverlay: { // Background and Height of Windows titlebar buttons
|
||
|
color: '#232323', // Background
|
||
|
symbolColor: 'white', // Icon
|
||
|
height: 44,
|
||
|
},
|
||
|
webPreferences: {
|
||
|
webviewTag: true
|
||
|
}
|
||
|
})
|
||
|
|
||
|
// Load Content
|
||
|
if (process.env.NODE_ENV === "development") {
|
||
|
mainWindow.loadURL('http://localhost:3000') // Use a URL in development mode
|
||
|
} else if (process.env.NODE_ENV === 'production') {
|
||
|
mainWindow.loadFile('app/index.html') // Do NOT use a URL in production mode, as that can create a security risk for your users who will use this app
|
||
|
}
|
||
|
|
||
|
// 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()})
|
||
|
|
||
|
// Functions
|
||
|
AppMenu.MainMenu()
|
||
|
Notification.Pushy()
|
||
|
Platform.Class()
|
||
|
Platform.Icon()
|
||
|
}
|
||
|
}
|