• Back to Glue42 Enterprise Docs
Glue42 enterprise documentation

Reference Documentation

  • Back to Glue42 Enterprise Docs
Press/
  • Glue
  • Application Preferences
  • AppManager
  • Channels
  • Connection
  • Displays
  • Hotkeys
  • Intents
  • Interop
  • Layouts
  • Logger
  • Metrics
  • Notifications
  • Pub Sub
  • Shared Contexts
  • Themes
  • Windows
  • Workspaces

Displays

5.11.0

Glue42 Enterprise 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 the glue.displays object.

APIobject

Description

Displays API

Available since version Glue42 Enteprise 3.9

Methods

  • all
  • capture
  • captureAll
  • get
  • getByWindowId
  • getMousePosition
  • getPrimary
  • onDisplayChanged

allmethod

Signature

() => Promise<Display[]>

Description

Returns all Display objects.

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 object specifying the ID of the display to capture and the size of the returned image.

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 object specifying the way the captured screenshots should be returned.

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.

Available since version 3.12

Parameters

Name Type Required Description
id string

Window ID of the desired display.

getMousePositionmethod

Signature

() => Promise<Point>

Description

Returns the X and Y coordinates of the mouse cursor.

getPrimarymethod

Signature

() => Promise<Display>

Description

Returns the primary display.

onDisplayChangedmethod

Signature

(cb: (displays: Display[]) => void) => UnsubscribeFunction

Description

Notifies when the display is changed.

Parameters

Name Type Required Description
cb (displays: Display[]) => void

AbsoluteSizeOptionsobject

Description

Absolute size of the returned image.

Properties

Property Type Default Required Description
height number

Height of the returned image.

keepAspectRatio 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.

width number

Width of the returned image.

Boundsobject

Description

Object describing the bounds of the display.

Properties

Property Type Default Required Description
height number

The height of the display (integer).

left number

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

top number

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

width number

The width of the display (integer).

CaptureAllOptionsobject

Description

Options for capturing all displays.

Properties

Property Type Default Required Description
combined boolean

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

size AbsoluteSizeOptions | ScaleOptions

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

CaptureOptionsobject

Description

Options for capturing a single display.

Properties

Property Type Default Required Description
id number

A number specifying the ID of the targeted display.

size AbsoluteSizeOptions | ScaleOptions

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

Displayobject

Description

Object describing 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

Whether this is the primary display.

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 X coordinate of the point.

y number

The 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.

  • © 2022 Glue42
  • Home
  • Privacy policy
  • Contact Sales
  • Glue42.com
  • Tick42.com
  • Overview
  • API
  • AbsoluteSizeOptions
  • Bounds
  • CaptureAllOptions
  • CaptureOptions
  • Display
  • Point
  • ScaleOptions
Navigate
Go