Displays

5.1.0

Glue42 Desktop provides a way for applications 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 glue.displays.

object

Description

Displays API.

methodall
() => Promise<Display[]>

Description

Returns all Display objects.

Returns

Promise<Display[]>

methodget
(id: number) => Promise<Display>

Description

Returns a single display by ID.

Parameters

Name
Type
Required
Description

id

number

yes

ID of the desired display.

Returns

Promise<Display>

methodgetPrimary
() => Promise<Display>

Description

Returns the primary display.

Returns

Promise<Display>

methodcaptureAll
(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

yes

Options object specifying the way the captured screenshots should be returned.

Returns

Promise<string | string[]>

methodcapture
(options: CaptureOptions) => Promise<string>

Description

Returns a base64 string of the screenshot of a single display.

Parameters

Name
Type
Required
Description

options

yes

Options object specifying the ID of the display to capture and the size of the returned image.

Returns

Promise<string>

() => Promise<Point>

Description

Returns the X and Y coordinates of the mouse cursor.

Returns

Promise<Point>

object

Description

Object describing a display.

Properties

number

Unique identifier associated with the display.

Bounds of the display (width, height, left and top coordinates)

The working area of the display.

number

Display resolution.

boolean

Whether this is the primary display.

number

Index assigned to the display by the operating system.

string

Name assigned to the display by the operating system.

string

Aspect ratio of the display (e.g., 16:9).

number

The scale factor of the returned display.

(size: ScaleOptions | AbsoluteSizeOptions) => Promise<string>

Captures a screenshot of the current display.

object

Description

Object describing the bounds of the display.

Properties

number

The height of the display (integer).

number

The width of the display (integer).

number

The horizontal coordinate of the top left corner of the display (integer).

number

The vertical coordinate of the top left corner of the display (integer).

object

Description

Coordinates of a point on the screen.

Properties

number

The X coordinate of the point.

number

The Y coordinate of the point.

object

Description

Options for capturing a single display.

Properties

number

A number specifying the ID of the targeted display.

Accepts either a ScaleOptions or an AbsoluteSizeOptions object, specifying the size of the output image.

object

Description

Options for capturing all displays.

Properties

boolean

Specifies whether to return a single image (if true) of all captured displays or a separate image (if false) for each captured display.

Accepts either a ScaleOptions or an AbsoluteSizeOptions object, specifying the size of the output image.

object

Description

Absolute size of the returned image.

Properties

number

Width of the returned image.

number

Height of the returned image.

boolean

Specifies whether to keep the aspect ratio of the output image when you specify width and/or height of the output image. If true and both width and height are set, then the specified width will be used as a basis for the output image aspect ratio.

object

Description

Relative size of the returned image.

Properties

number

Specifies the size of the output image relative to the actual screen size.