primaryScreen
Signature | hs.screen.primaryScreen() -> screen |
---|---|
Type | Constructor |
Description | Gets the primary screen |
Parameters |
|
Returns |
|
Source | extensions/screen/init.lua |
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 `true`, the methods `hs.screen:toEast()`, `:toNorth()` etc. will disregard screens that lie perpendicularly to the desired axis |
Source | extensions/screen/init.lua |
Signature | hs.screen.accessibilitySettings() -> table |
---|---|
Type | Function |
Description | Gets the current state of the screen-related accessibility settings |
Parameters |
|
Returns |
|
Source | extensions/screen/internal.m |
Signature | hs.screen.find(hint) -> hs.screen object(s) |
---|---|
Type | Function |
Description | Finds screens |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/screen/init.lua |
Signature | hs.screen.restoreGamma() |
---|---|
Type | Function |
Description | Restore the gamma settings to defaults |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/screen/internal.m |
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/init.lua |
Signature | hs.screen.allScreens() -> hs.screen[] |
---|---|
Type | Constructor |
Description | Returns all the screens |
Parameters |
|
Returns |
|
Source | extensions/screen/internal.m |
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/internal.m |
Signature | hs.screen.primaryScreen() -> screen |
---|---|
Type | Constructor |
Description | Gets the primary screen |
Parameters |
|
Returns |
|
Source | extensions/screen/init.lua |
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 `0,0` is at the screen's top left corner |
Parameters |
|
Returns |
|
Source | extensions/screen/init.lua |
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/internal.m |
Signature | hs.screen:currentMode() -> table |
---|---|
Type | Method |
Description | Returns a table describing the current screen mode |
Parameters |
|
Returns |
|
Source | extensions/screen/internal.m |
Signature | hs.screen:desktopImageURL([imageURL]) |
---|---|
Type | Method |
Description | Gets/Sets the desktop background image for a screen |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/screen/internal.m |
Signature | hs.screen:frame() -> hs.geometry rect |
---|---|
Type | Method |
Description | Returns the screen frame, without the dock or menu. |
Parameters |
|
Returns |
|
Source | extensions/screen/init.lua |
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/init.lua |
Signature | hs.screen:fullFrame() -> hs.geometry rect |
---|---|
Type | Method |
Description | Returns the screen frame, including the dock and menu. |
Parameters |
|
Returns |
|
Source | extensions/screen/init.lua |
Signature | hs.screen:getBrightness() -> number or nil |
---|---|
Type | Method |
Description | Gets the screen's brightness |
Parameters |
|
Returns |
|
Source | extensions/screen/internal.m |
Signature | hs.screen.getForceToGray() -> boolean |
---|---|
Type | Method |
Description | Gets the screen's ForceToGray setting |
Parameters |
|
Returns |
|
Source | extensions/screen/internal.m |
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/internal.m |
Signature | hs.screen.getInvertedPolarity() -> boolean |
---|---|
Type | Method |
Description | Gets the screen's InvertedPolarity setting |
Parameters |
|
Returns |
|
Source | extensions/screen/internal.m |
Signature | hs.screen:getUUID() -> string |
---|---|
Type | Method |
Description | Gets the UUID of an `hs.screen` object |
Parameters |
|
Returns |
|
Source | extensions/screen/internal.m |
Signature | hs.screen:id() -> number |
---|---|
Type | Method |
Description | Returns a screen's unique ID |
Parameters |
|
Returns |
|
Source | extensions/screen/internal.m |
Signature | hs.screen:localToAbsolute(geom) -> hs.geometry object |
---|---|
Type | Method |
Description | Transforms from the screen's local coordinate space, where `0,0` is at the screen's top left corner, to the absolute coordinate space used by OSX/Hammerspoon |
Parameters |
|
Returns |
|
Source | extensions/screen/init.lua |
Signature | hs.screen:mirrorOf(aScreen[, permanent]) -> bool |
---|---|
Type | Method |
Description | Make this screen mirror another |
Parameters |
|
Returns |
|
Source | extensions/screen/internal.m |
Signature | hs.screen:mirrorStop([permanent]) -> bool |
---|---|
Type | Method |
Description | Stops this screen mirroring another |
Parameters |
|
Returns |
|
Source | extensions/screen/internal.m |
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/internal.m |
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/init.lua |
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/init.lua |
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/init.lua |
Signature | hs.screen:rotate([degrees]) -> bool or rotation angle |
---|---|
Type | Method |
Description | Gets/Sets the rotation of a screen |
Parameters |
|
Returns |
|
Source | extensions/screen/internal.m |
Signature | hs.screen:setBrightness(brightness) -> |
---|---|
Type | Method |
Description | Sets the screen's brightness |
Parameters |
|
Returns |
|
Source | extensions/screen/internal.m |
Signature | hs.screen.setForceToGray(ForceToGray) -> None |
---|---|
Type | Method |
Description | Sets the screen's ForceToGray mode |
Parameters |
|
Returns |
|
Source | extensions/screen/internal.m |
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/internal.m |
Signature | hs.screen.setInvertedPolarity(InvertedPolarity) -> None |
---|---|
Type | Method |
Description | Sets the screen's InvertedPolarity mode |
Parameters |
|
Returns |
|
Source | extensions/screen/internal.m |
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/internal.m |
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/internal.m |
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/internal.m |
Signature | hs.screen:shotAsJPG(filePath[, screenRect]) |
---|---|
Type | Method |
Description | Saves an image of the screen to a JPG file |
Parameters |
|
Returns |
|
Source | extensions/screen/init.lua |
Signature | hs.screen:shotAsPNG(filePath[, screenRect]) |
---|---|
Type | Method |
Description | Saves an image of the screen to a PNG file |
Parameters |
|
Returns |
|
Source | extensions/screen/init.lua |
Signature | hs.screen:snapshot([rect]) -> object |
---|---|
Type | Method |
Description | Captures an image of the screen |
Parameters |
|
Returns |
|
Source | extensions/screen/internal.m |
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/init.lua |
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/init.lua |
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/init.lua |
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/init.lua |
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/init.lua |