-
Notifications
You must be signed in to change notification settings - Fork 511
Screen Object
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.
The Screen Object represents a screen. It can be used to reference screens in operations.
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();
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;
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;
Alias: main
Returns true
if this screen is the main screen, false
otherwise.
// assuming screen is the Screen Object
var isMain = screen.isMain();