From dbfa41acbdcb8ea1e58ac38455f61d6b2a91e008 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Mon, 20 Feb 2017 11:03:02 -0500 Subject: desktop window state should now be remembered #462 --- electron_js/main.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'electron_js/main.js') diff --git a/electron_js/main.js b/electron_js/main.js index 2e6941cf..7f3a955b 100644 --- a/electron_js/main.js +++ b/electron_js/main.js @@ -1,4 +1,5 @@ const electron = require('electron'); +const windowStateKeeper = require('electron-window-state'); //require('electron-debug')({showDevTools: true}); // Module to control application life. const {app} = electron; @@ -26,8 +27,19 @@ if (shouldQuit) { function createWindow() { // Create the browser window. - win = new BrowserWindow({width: 1024, height: 900, webPreferences:{nodeIntegration:false}}); + let mainWindowState = windowStateKeeper({ + defaultWidth: 1000, + defaultHeight: 800 + }); + //win = new BrowserWindow({width: 1024, height: 900, webPreferences:{nodeIntegration:false}}); + win = new BrowserWindow({ + x: mainWindowState.x, + y: mainWindowState.y, + width: mainWindowState.width, + height: mainWindowState.height, + webPreferences:{nodeIntegration:false}}); + mainWindowState.manage(win); // fs will be arg 1 if its not run in electron debug mode if (process.argv.slice(1)=='fs' || process.argv.slice(2)=='fs') win.setFullScreen(true); -- cgit v1.2.3