• Back to io.Connect Desktop docs
io.Connect Desktop Documentation

API Reference Documentation

  • Back to io.Connect Desktop docs
Press/
  • io.Connect Desktop
  • App Management
  • App Preferences
  • Channels
  • Cookies
  • Displays
  • Hotkeys
  • Intents
  • Interception
  • Interop
  • Layouts
  • Logger
  • Metrics
  • Notifications
  • Pub Sub
  • Search
  • Shared Contexts
  • Themes
  • Windows
  • Workspaces

Displays

6.13.0

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

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

allmethod

Signature

() => Promise<Display[]>

Description

Returns all available displays.

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

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 in pixels.

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 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 true, will return a single image of all captured displays. Otherwise, will return a separate image for each captured display.

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 true, 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 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.

  • Home
  • Privacy policy
  • Contact Us
  • interop.io
  • Overview
  • API
  • AbsoluteSizeOptions
  • Bounds
  • CaptureAllOptions
  • CaptureOptions
  • Display
  • Point
  • ScaleOptions
Navigate
Go