Control monitors.
NOTE: Monitors are supported only on
Windows
, but onmacOS
there's a stub object calledEmptyMonitor
for better cross-platform compatibility without checking whether a returned monitor isundefined
.
import { windowManager } from 'node-window-manager';
// Gets height of the primary window working area.
const { height } = windowManager.getPrimaryWindow().getWorkArea();
id
number - the monitor handle
id
number
NOTE: on macOS this method returns
{x: 0, y: 0, width: 0, height: 0}
for compatibility.
- Returns
Rectangle
NOTE: on macOS this method returns
{x: 0, y: 0, width: 0, height: 0}
for compatibility.
Gets monitor working area bounds.
Returns Rectangle
NOTE: on macOS this method returns
false
for compatibility.
Whether the monitor is primary.
Returns boolean
NOTE: on macOS this method returns
1
for compatibility.
Gets monitor scale factor (DPI).
- Returns
number
Returns:
- On
Windows
:true
- On
macOS
:false
, since it's just anEmptyMonitor
object.