Skip to content
Matthew Steiner edited this page May 19, 2013 · 6 revisions

The Screen Object is returned by various Slate API functions. This page describes it in detail.

Description

The Screen Object represents a screen. It can be used to reference screens in operations.

Functions

id

Return the id of the Screen. This can be used to reference the screen in operations.

// assuming screen is the Screen Object
var screenId = screen.id();

rect

Return the rectangle that represents this Screen's location and size.

// assuming screen is the Screen Object
var rect = screen.rect();
var topLeftX = rect.x;
var topLeftY = rect.y;
var width = rect.width;
var height = rect.height;

visibleRect

Alias: vrect

Return the rectangle that represents this Screen's visible location and size. This takes the menu bar and dock into account and will return the size and location of the screen without those components.

// assuming screen is the Screen Object
var rect = screen.visibleRect();
var topLeftX = rect.x;
var topLeftY = rect.y;
var width = rect.width;
var height = rect.height;

isMain

Alias: main

Returns true if this screen is the main screen, false otherwise.

// assuming screen is the Screen Object
var isMain = screen.isMain();
Clone this wiki locally