Remember and Recall window layout so that position+size persist
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/3622/head
parent
e40c6905dd
commit
76008e8abd
|
@ -30,6 +30,8 @@ const tray = require('./tray');
|
|||
|
||||
const VectorMenu = require('./vectormenu');
|
||||
|
||||
const windowStateKeeper = require('electron-window-state');
|
||||
|
||||
let vectorConfig = {};
|
||||
try {
|
||||
vectorConfig = require('../../webapp/config.json');
|
||||
|
@ -186,11 +188,21 @@ electron.app.on('ready', () => {
|
|||
process.platform == 'win32' ? 'ico' : 'png'
|
||||
);
|
||||
|
||||
// Load the previous window state with fallback to defaults
|
||||
let mainWindowState = windowStateKeeper({
|
||||
defaultWidth: 1024,
|
||||
defaultHeight: 768,
|
||||
});
|
||||
|
||||
mainWindow = new electron.BrowserWindow({
|
||||
icon: icon_path,
|
||||
width: 1024, height: 768,
|
||||
show: false,
|
||||
autoHideMenuBar: true,
|
||||
|
||||
x: mainWindowState.x,
|
||||
y: mainWindowState.y,
|
||||
width: mainWindowState.width,
|
||||
height: mainWindowState.height,
|
||||
});
|
||||
mainWindow.loadURL(`file://${__dirname}/../../webapp/index.html`);
|
||||
electron.Menu.setApplicationMenu(VectorMenu);
|
||||
|
@ -226,6 +238,8 @@ electron.app.on('ready', () => {
|
|||
onLinkContextMenu(ev, params);
|
||||
}
|
||||
});
|
||||
|
||||
mainWindowState.manage(mainWindow);
|
||||
});
|
||||
|
||||
electron.app.on('window-all-closed', () => {
|
||||
|
|
|
@ -96,6 +96,7 @@
|
|||
"css-raw-loader": "^0.1.1",
|
||||
"electron-builder": "^11.2.4",
|
||||
"electron-builder-squirrel-windows": "^11.2.1",
|
||||
"electron-window-state": "^4.1.0",
|
||||
"emojione": "^2.2.7",
|
||||
"eslint": "^3.14.0",
|
||||
"eslint-config-google": "^0.7.1",
|
||||
|
|
Loading…
Reference in New Issue