
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
electron-window-state-manager
Advanced tools
The Electron Window State Manager is a small package that gives you the ability to save the state of a BrowserWindow and retreive the saved data of the state later.
npm install electron-window-state-manager
The Window State Manager can store the dimensions (width and height), the position (x and y coordinates) and the current state (maximized or not) of a BrowserWindow and save it to a json file.
The saved state can than later be retreived when using the same window name at the instance creation.
The saved state's data will be automatically retreived when creating a WindowStateManagerinstance with an already saved window name.
To be able to use this package in your project you need to require it:
const WindowStateManager = require('electron-window-state-manager');
It creates a new WindowStateManager with a name and default properties as set by the options.
new WindowStateManager(name, [options])name String - Name of the window.options Object
defaultWidth Integer - Default window width in pixels.defaultHeight Integer - Default window height in pixels.The value of name is used to reference a saved state in the json file. If you create a new instance of WindowStateManager with a name which was already saved previously, the data of this state will be loaded.
If a state with the value of name cannot be found in the json file or a saved state has wrong data, the default values assigned in the options Object will be used.
The WindowStateManager class has the following methods:
WindowStateManager.saveState(window)window BrowserWindowSaves the state of the passed BrowserWindow and returns trueor false depending on whether the state was successfully saved to the json file.
In case the state of a window in fullscreen is saved, the saving process will not succeed because we don't want to save the dimensions of a fullscreen window.
The method returns false and will not save anything if a window in fullscreen is saved, because we don't want to save the dimensions of a fullscreen window.
If a maximized window is saved, the dimensions and position of the window will not be stored, only the previously saved values or the default values will be saved. However the maximized state of the window will be saved, so that you can open the window in a maximized state again later if the window was closed in a maximized state.
const app = require('electron').app;
const BrowserWindow = require('electron').BrowserWindow;
const WindowStateManager = require('electron-window-state-manager');
const mainWindow;
// Create a new instance of the WindowStateManager
// and pass it the name and the default properties
const mainWindowState = new WindowStateManager('mainWindow', {
defaultWidth: 1024,
defaultHeight: 768
});
app.on('ready', () => {
// When creating a new BrowserWindow
// you can assign the properties of the mainWindowState.
// If a window with the name 'main' was saved before,
// the saved values will now be assigned to the BrowserWindow again
mainWindow = new BrowserWindow({
width: mainWindowState.width,
height: mainWindowState.height,
x: mainWindowState.x,
y: mainWindowState.y,
});
// You can check if the window was closed in a maximized saveState
// If so you can maximize the BrowserWindow again
if (mainWindowState.maximized) {
mainWindow.maximize();
}
// Don't forget to save the current state
// of the Browser window when it's about to be closed
mainWindow.on('close', () => {
mainWindowState.saveState(mainWindow);
});
});
FAQs
Window-state manager for electron
The npm package electron-window-state-manager receives a total of 191 weekly downloads. As such, electron-window-state-manager popularity was classified as not popular.
We found that electron-window-state-manager demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.