54 lines
No EOL
2 KiB
JavaScript
Executable file
54 lines
No EOL
2 KiB
JavaScript
Executable file
const {BrowserWindow} = require('electron')
|
|
const path = require('path')
|
|
const {TitlebarRespect} = require('electron-titlebar-respect')
|
|
|
|
let AppMenu = require('./menu')
|
|
let Notification = require('./notifications')
|
|
let Platform = require('./platform')
|
|
|
|
TitlebarRespect({})
|
|
|
|
module.exports = {
|
|
Create: function() {
|
|
mainWindow = new BrowserWindow({
|
|
title: process.env.Name, // Edit this in .env
|
|
minWidth: 400,
|
|
minHeight: 400,
|
|
width: 1200,
|
|
height: 800,
|
|
autoHideMenuBar: true,
|
|
show: false,
|
|
frame: global.frame, // Controlled by Electron Titlebar Respect
|
|
titleBarStyle: global.titleBarStyle, // Controlled by Electron Titlebar Respect
|
|
icon: global.AppIcon, // Found in ./platform.js
|
|
vibrancy: 'sidebar',
|
|
transparent: true,
|
|
trafficLightPosition: { x: 25, y: 28 }, // 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:1567') // 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()
|
|
}
|
|
} |