Get monitors and opened windows.
import { windowManager } from 'node-window-manager';
windowManager.requestAccessibility();
const window = windowManager.getActiveWindow();
// Prints the currently focused window title.
console.log(window.getTitle());
If the accessibility permission is not granted on macOS
, it opens an accessibility permission request dialog.
The method is required to call before calling the following methods:
window.setBounds
window.maximize
window.minimize
window.restore
window.bringToTop
window.getTitle
Returns boolean
Returns Window
Returns Window[]
NOTE: on macOS this method returns
[]
for compatibility.
- Returns
Monitor[]
NOTE: on macOS this method returns an
EmptyMonitor
object for compatibility.
- Returns
Monitor
Returns:
Emitted when a window has been activated.