restore-window
v1.1.0
Published
Module to restore or minimize Windows windows by title
Maintainers
Readme
restore-window
CLI + Node.js library to restore or minimize a Windows window by its exact title, available with both synchronous and asynchronous APIs.
🔧 Features
- Restore a minimized window by title
- Minimize a visible window by title
- Zero-JS-shim CLI: invokes the native
restore-window.exedirectly - Node.js API for programmatic control (sync & async)
- Windows-only (skips install on other platforms)
📦 Installation
npm install -g restore-window⚠️ Windows only. On non-Windows platforms the installer will warn and exit harmlessly.
🚀 Usage
CLI
Invoke the native binary directly:
restore-window -t "Untitled - Notepad" -restore
restore-window -t "My App" -minimize-t "<window title>"- Exactly one of:
-restore-minimize
If the window is not found or already in the requested state, an error or status message is printed.
API
Synchronous (blocking)
const rw = require('restore-window');
// restore a window
try {
const msg = rw.restoreSync("Untitled - Notepad");
console.log(msg); // → Window 'Untitled - Notepad' restored.
} catch (err) {
console.error(err.message);
}
// minimize a window
try {
const msg = rw.minimizeSync("Calculator");
console.log(msg); // → Window 'Calculator' minimized.
} catch (err) {
console.error(err.message);
}Asynchronous (non-blocking)
const rw = require('restore-window');
(async () => {
try {
const msg1 = await rw.restore("Untitled - Notepad");
console.log(msg1); // → Window 'Untitled - Notepad' restored.
const msg2 = await rw.minimize("Calculator");
console.log(msg2); // → Window 'Calculator' minimized.
} catch (err) {
console.error(err.message);
}
})();🤝 Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -m "feat: add ...") - Push to the branch (
git push origin feature/my-feature) - Open a Pull Request
Please ensure all new code is covered by tests and follows the existing style.
📄 License
This project is licensed under the MIT License. See LICENSE for details.
