EZPPLauncher/ui/windowManager.js

45 lines
1.4 KiB
JavaScript
Raw Normal View History

2022-10-16 13:54:29 +00:00
const path = require("path");
2022-10-16 21:16:05 +00:00
const appInfo = require('../appInfo');
2023-06-02 10:22:28 +00:00
const { BrowserWindow, Menu } = require('electron');
2022-10-16 13:54:29 +00:00
const { attachTitlebarToWindow } = require('custom-electron-titlebar/main');
module.exports = {
createWindow: function (windowWidth, windowHeight) {
const window = new BrowserWindow({
width: windowWidth,
height: windowHeight,
minHeight: windowHeight / 1.25,
minWidth: windowWidth / 1.25,
frame: false,
titleBarStyle: 'hidden',
2022-12-23 20:41:23 +00:00
backgroundColor: "#24283B",
2022-10-16 13:54:29 +00:00
resizable: false,
maximizable: false,
minimizable: true,
alwaysOnTop: false,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
show: false,
zoomFactor: 0.9,
preload: path.join(__dirname, '../preload/preload.js')
},
icon: './assets/logo.png'
})
2023-06-02 10:22:28 +00:00
const menu = Menu.buildFromTemplate([])
Menu.setApplicationMenu(menu);
2022-10-16 13:54:29 +00:00
window.hide();
window.webContents.once("did-finish-load", function (event, input) {
window.show();
});
2022-10-16 21:16:05 +00:00
window.webContents.setUserAgent(`${appInfo.appName} ${appInfo.appVersion}`);
2023-06-02 10:22:28 +00:00
2022-10-16 13:54:29 +00:00
attachTitlebarToWindow(window);
return window;
},
}