A library to store and restore window sizes and positions for your Electron app
Install with npm:
npm install stateful-electron-window
import { StatefullBrowserWindow } from 'stateful-electron-window'
const mainWindow = new StatefullBrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js')
},
supportMaximize: true
})
StatefullBrowserWindow extends BrowserWindow.
configFilePath
- String
The path where the state file should be written to. Defaults to
app.getPath('userData')
configFileName
- String
The name of file. Defaults to window-state.json
. This is usefull if you want to support multiple windows.
supportMaximize
- Boolean
Should we automatically maximize the window, if it was last closed
maximized. Defaults to false