Manage windows in Windows, macOS and Linux(WIP)
To install this package, just run
$ npm install node-window-manager
The 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 });
x
numbery
numberwidth
numberheight
number
id
numbertitle
stringprocessId
stringpath
string - path to executable associated with the windowbounds
Rectangle
opacity
number (Windows
)owner
Window
(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 anumber
or aWindowInfo
object.
id
numberprocessId
number - process id associated with the windowpath
string - 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
win
Window | number | null- pass null to unset window owner.