|
|
|
@ -13,6 +13,8 @@ const appMenu = require('./menu');
|
|
|
|
|
const tray = require('./tray'); |
|
|
|
|
// Require for autpUpdate file
|
|
|
|
|
const autoupdater = require('./autoupdater'); |
|
|
|
|
// Window State Plugin
|
|
|
|
|
const windowStateKeeper = require('electron-window-state'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const MenuItem = electron.MenuItem; |
|
|
|
@ -91,11 +93,21 @@ let mainWindow;
|
|
|
|
|
let isQuitting = false; |
|
|
|
|
|
|
|
|
|
function createWindow () { |
|
|
|
|
// Create the browser window.
|
|
|
|
|
// Load the previous state with fallback to defaults
|
|
|
|
|
let mainWindowState = windowStateKeeper({ |
|
|
|
|
defaultWidth: 1000 |
|
|
|
|
,defaultHeight: 800 |
|
|
|
|
,maximize: true |
|
|
|
|
}); |
|
|
|
|
// Create the browser window using the state information
|
|
|
|
|
mainWindow = new BrowserWindow({ |
|
|
|
|
title: 'Rambox' |
|
|
|
|
,skipTaskbar: false |
|
|
|
|
,icon: __dirname + '/../resources/Icon.png' |
|
|
|
|
,x: mainWindowState.x |
|
|
|
|
,y: mainWindowState.y |
|
|
|
|
,width: mainWindowState.width |
|
|
|
|
,height: mainWindowState.height |
|
|
|
|
,webPreferences: { |
|
|
|
|
webSecurity: false |
|
|
|
|
,nodeIntegration: true |
|
|
|
@ -104,10 +116,12 @@ function createWindow () {
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
process.setMaxListeners(100); |
|
|
|
|
// Let us register listeners on the window, so we can update the state
|
|
|
|
|
// automatically (the listeners will be removed when the window is closed)
|
|
|
|
|
// and restore the maximized or full screen state
|
|
|
|
|
mainWindowState.manage(mainWindow); |
|
|
|
|
|
|
|
|
|
// Start maximize
|
|
|
|
|
mainWindow.maximize(); |
|
|
|
|
process.setMaxListeners(100); |
|
|
|
|
|
|
|
|
|
// and load the index.html of the app.
|
|
|
|
|
mainWindow.loadURL('file://' + __dirname + '/../index.html'); |
|
|
|
|