Manage windows in Windows, macOS and Linux(WIP)
To install this package, just run
$ npm install node-window-managerThe following example shows how to get the currently focused window's title and hide it.
const { windowManager } = require("node-window-manager");
const window = windowManager.getActiveWindow();
// Prints the currently focused window title.
console.log(window.getTitle());
// Moves the window.
window.setBounds({ x: 0, y: 0 });xnumberynumberwidthnumberheightnumber
idnumbertitlestringprocessIdstringpathstring - path to executable associated with the windowboundsRectangleopacitynumber (Windows)ownerWindow(Windows) - owner window of the current window
- Returns
Window
- Returns
number- the monitor scale factor.
- Returns
Window[]
Returns:
Emitted when a window has been activated.
We try to keep this class similar to Electron's known BrowserWindow class, to keep it simple to use.
new Window(id: number | WindowInfo)
id- this can be either anumberor aWindowInfoobject.
idnumberprocessIdnumber - process id associated with the windowpathstring - path to executable associated with the window
- Returns
Rectangle
Resizes and moves the window to the supplied bounds. Any properties that are not supplied will default to their current values.
window.setBounds({ height: 50 });Returns WindowInfo
- Returns
string
Shows the window.
Hides the window.
Minimizes the window.
Restores the window.
Maximizes the window.
Brings the window to top and focuses it.
opacity- a value between 0 and 1.
Sets the window opacity.
Gets the window opacity
Returns number between 0 and 1.
Gets monitor by window.
Returns number - monitor handle.
Returns boolean - whether the window is a valid window.
Returns boolean - whether the window is visible or not.
Returns Window
win.setOwner(win: Window | number | null) Windows
winWindow | number | null- pass null to unset window owner.