File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ const tray = require('./tray');
3030
3131const VectorMenu = require ( './vectormenu' ) ;
3232
33+ const windowStateKeeper = require ( 'electron-window-state' ) ;
34+
3335let vectorConfig = { } ;
3436try {
3537 vectorConfig = require ( '../../webapp/config.json' ) ;
@@ -186,11 +188,21 @@ electron.app.on('ready', () => {
186188 process . platform == 'win32' ? 'ico' : 'png'
187189 ) ;
188190
191+ // Load the previous window state with fallback to defaults
192+ let mainWindowState = windowStateKeeper ( {
193+ defaultWidth : 1024 ,
194+ defaultHeight : 768 ,
195+ } ) ;
196+
189197 mainWindow = new electron . BrowserWindow ( {
190198 icon : icon_path ,
191- width : 1024 , height : 768 ,
192199 show : false ,
193200 autoHideMenuBar : true ,
201+
202+ x : mainWindowState . x ,
203+ y : mainWindowState . y ,
204+ width : mainWindowState . width ,
205+ height : mainWindowState . height ,
194206 } ) ;
195207 mainWindow . loadURL ( `file://${ __dirname } /../../webapp/index.html` ) ;
196208 electron . Menu . setApplicationMenu ( VectorMenu ) ;
@@ -226,6 +238,8 @@ electron.app.on('ready', () => {
226238 onLinkContextMenu ( ev , params ) ;
227239 }
228240 } ) ;
241+
242+ mainWindowState . manage ( mainWindow ) ;
229243} ) ;
230244
231245electron . app . on ( 'window-all-closed' , ( ) => {
Original file line number Diff line number Diff line change 9696 "css-raw-loader" : " ^0.1.1" ,
9797 "electron-builder" : " ^11.2.4" ,
9898 "electron-builder-squirrel-windows" : " ^11.2.1" ,
99+ "electron-window-state" : " ^4.1.0" ,
99100 "emojione" : " ^2.2.7" ,
100101 "eslint" : " ^3.14.0" ,
101102 "eslint-config-google" : " ^0.7.1" ,
You can’t perform that action at this time.
0 commit comments