Displays
6.9.0io.Connect Desktop provides a way for apps to programmatically capture screenshots of the available monitors, of windows and window groups. Based on custom logic, you can capture one or all monitors in order to save a snapshot of the visual state at a given moment.
The Displays API is accessible through the io.displays
object.
APIobject
Description
Displays API.
Methods
allmethod
capturemethod
Signature
(options: CaptureOptions) => Promise<string>
Description
Returns a Base64 string of the screenshot of a single display.
Parameters
Name | Type | Required | Description |
---|---|---|---|
options | CaptureOptions | Options for capturing the display. |
captureAllmethod
Signature
(options: CaptureAllOptions) => Promise<string | string[]>
Description
Returns a Base64 string of the screenshots of all displays. The returned value depends on the combined
property specified in the options object.
Parameters
Name | Type | Required | Description |
---|---|---|---|
options | CaptureAllOptions | Options for capturing the displays. |
getmethod
Signature
(id: number) => Promise<Display>
Description
Returns a single display by ID.
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | number | ID of the desired display. |
getByWindowIdmethod
Signature
(id: string) => Promise<Display>
Description
Returns a single display by window ID.
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | string | Window ID of the desired display. |
getMousePositionmethod
getPrimarymethod
AbsoluteSizeOptionsobject
Description
Absolute size of the returned image.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
height | number | Height of the returned image in pixels. |
||
keepAspectRatio | boolean | Specifies whether to keep the aspect ratio of the output image when you specify |
||
width | number | Width of the returned image in pixels. |
Boundsobject
Description
Describes the display bounds.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
height | number | Height of the display in pixels. |
||
left | number | The horizontal coordinate of the top left corner of the display in pixels. |
||
top | number | The vertical coordinate of the top left corner of the display in pixels. |
||
width | number | Width of the display in pixels. |
CaptureAllOptionsobject
Description
Options for capturing all displays.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
combined | boolean | If |
||
size | AbsoluteSizeOptions | ScaleOptions | Size of the output image. |
CaptureOptionsobject
Description
Options for capturing a single display.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
id | number | ID of the targeted display. |
||
size | AbsoluteSizeOptions | ScaleOptions | Size of the output image. |
Displayobject
Description
Describes a display.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
aspectRatio | string | Aspect ratio of the display (e.g., 16:9). |
||
bounds | Bounds | Bounds of the display (width, height, left and top coordinates). |
||
capture | (size: AbsoluteSizeOptions | ScaleOptions) => Promise<string> | Captures a screenshot of the current display. |
||
dpi | number | Display resolution. |
||
id | number | Unique identifier associated with the display. |
||
index | number | Index assigned to the display by the operating system. |
||
isPrimary | boolean | If |
||
name | string | Name assigned to the display by the operating system. |
||
scaleFactor | number | The scale factor of the returned display. |
||
workArea | Bounds | The working area of the display. |
Pointobject
Description
Coordinates of a point on the screen.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
x | number | The horizontal X coordinate of the point. |
||
y | number | The vertical Y coordinate of the point. |
ScaleOptionsobject
Description
Relative size of the returned image.
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
scale | number | Specifies the size of the output image relative to the actual screen size. |