@@ -3,6 +3,8 @@ import * as os from 'os';
33import * as path from 'path' ;
44import { app , BrowserWindow , shell , Menu } from 'electron' ;
55
6+ import * as windowStateKeeper from 'electron-window-state' ;
7+
68import registerContextMenu = require( 'electron-context-menu' ) ;
79registerContextMenu ( {
810 showSaveImageAs : true
@@ -26,16 +28,25 @@ app.commandLine.appendSwitch('ignore-connections-limit', 'app.httptoolkit.tech')
2628app . commandLine . appendSwitch ( 'disable-renderer-backgrounding' ) ;
2729
2830const createWindow = ( ) => {
31+ // Load the previous window state, falling back to defaults
32+ let mainWindowState = windowStateKeeper ( {
33+ defaultWidth : 1366 ,
34+ defaultHeight : 768
35+ } ) ;
36+
2937 mainWindow = new BrowserWindow ( {
3038 title : 'HTTP Toolkit' ,
3139 icon : path . join ( __dirname , 'src' , 'icon.png' ) ,
3240 backgroundColor : '#d8e2e6' ,
3341
34- width : 1366 ,
35- height : 768 ,
3642 minWidth : 1024 ,
3743 minHeight : 700 ,
3844
45+ x : mainWindowState . x ,
46+ y : mainWindowState . y ,
47+ width : mainWindowState . width ,
48+ height : mainWindowState . height ,
49+
3950 webPreferences : {
4051 contextIsolation : true ,
4152 nodeIntegration : false
@@ -44,6 +55,8 @@ const createWindow = () => {
4455 show : false
4556 } ) ;
4657
58+ mainWindowState . manage ( mainWindow ) ;
59+
4760 mainWindow . loadURL ( APP_URL ) ;
4861
4962 mainWindow . on ( 'ready-to-show' , function ( ) {
0 commit comments