primaryScreen
Signature | hs.screen.primaryScreen() -> screen |
---|---|
Type | Constructor |
Description | Gets the primary screen |
Parameters |
|
Returns |
|
Source | extensions/screen/screen.lua line 30 |
Manipulate screens (i.e. monitors)
The macOS coordinate system used by Hammerspoon assumes a grid that spans all the screens (positioned as per
System Preferences->Displays->Arrangement). The origin 0,0
is at the top left corner of the primary screen.
(Screens to the left of the primary screen, or above it, and windows on these screens, will have negative coordinates)
Signature | hs.screen.strictScreenInDirection |
---|---|
Type | Variable |
Description | If set to |
Source | extensions/screen/screen.lua line 343 |
Signature | hs.screen.accessibilitySettings() -> table |
---|---|
Type | Function |
Description | Gets the current state of the screen-related accessibility settings |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 1337 |
Signature | hs.screen.find(hint) -> hs.screen object(s) |
---|---|
Type | Function |
Description | Finds screens |
Parameters |
|
Returns |
|
Notes |
Example: hs.screen(724562417) --> Color LCD - by id
hs.screen'Dell' --> DELL U2414M - by name
hs.screen'Built%-in' --> Built-in Retina Display, note the % to escape the hyphen repetition character
hs.screen'0,0' --> PHL BDM4065 - by position, same as hs.screen.primaryScreen()
hs.screen{x=-1,y=0} --> DELL U2414M - by position, screen to the immediate left of the primary screen
hs.screen'3840x2160' --> PHL BDM4065 - by screen resolution
hs.screen'-500,240 700x1300' --> DELL U2414M, by arbitrary rect
|
Source | extensions/screen/screen.lua line 43 |
Signature | hs.screen.restoreGamma() |
---|---|
Type | Function |
Description | Restore the gamma settings to defaults |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/screen/libscreen.m line 294 |
Signature | hs.screen.screenPositions() -> table |
---|---|
Type | Function |
Description | Returns a list of all connected and enabled screens, along with their "position" relative to the primary screen |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/screen/screen.lua line 124 |
Signature | hs.screen.allScreens() -> hs.screen[] |
---|---|
Type | Constructor |
Description | Returns all the screens |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 907 |
Signature | hs.screen.mainScreen() -> screen |
---|---|
Type | Constructor |
Description | Returns the 'main' screen, i.e. the one containing the currently focused window |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 932 |
Signature | hs.screen.primaryScreen() -> screen |
---|---|
Type | Constructor |
Description | Gets the primary screen |
Parameters |
|
Returns |
|
Source | extensions/screen/screen.lua line 30 |
Signature | hs.screen:absoluteToLocal(geom) -> hs.geometry object |
---|---|
Type | Method |
Description | Transforms from the absolute coordinate space used by OSX/Hammerspoon to the screen's local coordinate space, where |
Parameters |
|
Returns |
|
Source | extensions/screen/screen.lua line 259 |
Signature | hs.screen:availableModes() -> table |
---|---|
Type | Method |
Description | Returns a table containing the screen modes supported by the screen. A screen mode is a combination of resolution, scaling factor and colour depth |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/screen/libscreen.m line 174 |
Signature | hs.screen:currentMode() -> table |
---|---|
Type | Method |
Description | Returns a table describing the current screen mode |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 125 |
Signature | hs.screen:desktopImageURL([imageURL]) |
---|---|
Type | Method |
Description | Gets/Sets the desktop background image for a screen |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/screen/libscreen.m line 1295 |
Signature | hs.screen:frame() -> hs.geometry rect |
---|---|
Type | Method |
Description | Returns the screen frame, without the dock or menu. |
Parameters |
|
Returns |
|
Source | extensions/screen/screen.lua line 198 |
Signature | hs.screen:fromUnitRect(unitrect) -> hs.geometry rect |
---|---|
Type | Method |
Description | Returns the absolute rect of a given unit rect within this screen |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/screen/screen.lua line 214 |
Signature | hs.screen:fullFrame() -> hs.geometry rect |
---|---|
Type | Method |
Description | Returns the screen frame, including the dock and menu. |
Parameters |
|
Returns |
|
Source | extensions/screen/screen.lua line 182 |
Signature | hs.screen:getBrightness() -> number or nil |
---|---|
Type | Method |
Description | Gets the screen's brightness |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 629 |
Signature | hs.screen.getForceToGray() -> boolean |
---|---|
Type | Method |
Description | Gets the screen's ForceToGray setting |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 774 |
Signature | hs.screen:getGamma() -> [whitepoint, blackpoint] or nil |
---|---|
Type | Method |
Description | Gets the current whitepoint and blackpoint of the screen |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 316 |
Signature | hs.screen:getInfo() -> table or nil |
---|---|
Type | Method |
Description | Gets a table of information about an |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 740 |
Signature | hs.screen.getInvertedPolarity() -> boolean |
---|---|
Type | Method |
Description | Gets the screen's InvertedPolarity setting |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 812 |
Signature | hs.screen:getUUID() -> string |
---|---|
Type | Method |
Description | Gets the UUID of an |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 711 |
Signature | hs.screen:id() -> number |
---|---|
Type | Method |
Description | Returns a screen's unique ID |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 45 |
Signature | hs.screen:localToAbsolute(geom) -> hs.geometry object |
---|---|
Type | Method |
Description | Transforms from the screen's local coordinate space, where |
Parameters |
|
Returns |
|
Source | extensions/screen/screen.lua line 246 |
Signature | hs.screen:mirrorOf(aScreen[, permanent]) -> bool |
---|---|
Type | Method |
Description | Make this screen mirror another |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 1145 |
Signature | hs.screen:mirrorStop([permanent]) -> bool |
---|---|
Type | Method |
Description | Stops this screen mirroring another |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 1178 |
Signature | hs.screen:name() -> string or nil |
---|---|
Type | Method |
Description | Returns the preferred name for the screen set by the manufacturer |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 64 |
Signature | hs.screen:next() -> screen |
---|---|
Type | Method |
Description | Gets the screen 'after' this one (in arbitrary order); this method wraps around to the first screen. |
Parameters |
|
Returns |
|
Source | extensions/screen/screen.lua line 272 |
Signature | hs.screen:position() -> x, y |
---|---|
Type | Method |
Description | Return a given screen's position relative to the primary screen - see 'hs.screen.screenPositions()' |
Parameters |
|
Returns |
|
Source | extensions/screen/screen.lua line 166 |
Signature | hs.screen:previous() -> screen |
---|---|
Type | Method |
Description | Gets the screen 'before' this one (in arbitrary order); this method wraps around to the last screen. |
Parameters |
|
Returns |
|
Source | extensions/screen/screen.lua line 289 |
Signature | hs.screen:rotate([degrees]) -> bool or rotation angle |
---|---|
Type | Method |
Description | Gets/Sets the rotation of a screen |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 1023 |
Signature | hs.screen:setBrightness(brightness) -> |
---|---|
Type | Method |
Description | Sets the screen's brightness |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 676 |
Signature | hs.screen.setForceToGray(ForceToGray) -> None |
---|---|
Type | Method |
Description | Sets the screen's ForceToGray mode |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 793 |
Signature | hs.screen:setGamma(whitepoint, blackpoint) -> boolean |
---|---|
Type | Method |
Description | Sets the current white point and black point of the screen |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/screen/libscreen.m line 512 |
Signature | hs.screen.setInvertedPolarity(InvertedPolarity) -> None |
---|---|
Type | Method |
Description | Sets the screen's InvertedPolarity mode |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 831 |
Signature | hs.screen:setMode(width, height, scale, frequency, depth) -> boolean |
---|---|
Type | Method |
Description | Sets the screen to a new mode |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/screen/libscreen.m line 246 |
Signature | hs.screen:setOrigin(x, y) -> bool |
---|---|
Type | Method |
Description | Sets the origin of a screen in the global display coordinate space. The origin of the main or primary display is (0,0). The new origin is placed as close as possible to the requested location, without overlapping or leaving a gap between displays. If you use this function to change the origin of a mirrored display, the display may be removed from the mirroring set. |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 1102 |
Signature | hs.screen:setPrimary() -> boolean |
---|---|
Type | Method |
Description | Sets the screen to be the primary display (i.e. contain the menubar and dock) |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 950 |
Signature | hs.screen:shotAsJPG(filePath[, screenRect]) |
---|---|
Type | Method |
Description | Saves an image of the screen to a JPG file |
Parameters |
|
Returns |
|
Source | extensions/screen/screen.lua line 410 |
Signature | hs.screen:shotAsPNG(filePath[, screenRect]) |
---|---|
Type | Method |
Description | Saves an image of the screen to a PNG file |
Parameters |
|
Returns |
|
Source | extensions/screen/screen.lua line 395 |
Signature | hs.screen:snapshot([rect]) -> object |
---|---|
Type | Method |
Description | Captures an image of the screen |
Parameters |
|
Returns |
|
Source | extensions/screen/libscreen.m line 1270 |
Signature | hs.screen:toEast(from, strict) -> hs.screen object |
---|---|
Type | Method |
Description | Gets the first screen to the east of this one, ordered by proximity to its center or a specified point. |
Parameters |
|
Returns |
|
Source | extensions/screen/screen.lua line 348 |
Signature | hs.screen:toNorth(from, strict) -> hs.screen object |
---|---|
Type | Method |
Description | Gets the first screen to the north of this one, ordered by proximity to its center or a specified point. |
Parameters |
|
Returns |
|
Source | extensions/screen/screen.lua line 370 |
Signature | hs.screen:toSouth(from, strict) -> hs.screen object |
---|---|
Type | Method |
Description | Gets the first screen to the south of this one, ordered by proximity to its center or a specified point. |
Parameters |
|
Returns |
|
Source | extensions/screen/screen.lua line 381 |
Signature | hs.screen:toUnitRect(rect) -> hs.geometry unitrect |
---|---|
Type | Method |
Description | Returns the unit rect of a given rect, relative to this screen |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/screen/screen.lua line 230 |
Signature | hs.screen:toWest(from, strict) -> hs.screen object |
---|---|
Type | Method |
Description | Gets the first screen to the west of this one, ordered by proximity to its center or a specified point. |
Parameters |
|
Returns |
|
Source | extensions/screen/screen.lua line 359 |