ReadonlyavailableAll display modes supported by this screen.
Each element has keys: width, height, scale, frequency.
The URL string of the current desktop background image for this screen, or null.
Assign a new absolute file path or file:// URL string to change the wallpaper.
ReadonlyframeThe usable screen area in Hammerspoon coordinates, excluding the menu bar and Dock.
ReadonlyfullThe full screen area in Hammerspoon coordinates, including menu bar and Dock regions.
ReadonlyidUnique display identifier (matches CGDirectDisplayID).
ReadonlymodeThe currently active display mode.
An object with keys: width, height, scale, frequency.
ReadonlynameThe manufacturer-assigned localized display name.
ReadonlypositionThe screen's top-left corner in global Hammerspoon coordinates.
The current screen rotation in degrees (0, 90, 180, or 270).
Assign one of 0, 90, 180, or 270 to rotate the display.
ReadonlyuuidThe display's UUID string.
Convert a rect in global Hammerspoon coordinates to coordinates local to this screen. The result origin is relative to this screen's top-left corner.
An HSRect in global Hammerspoon coordinates.
The rect offset to be relative to this screen's top-left, or null if the input is invalid.
Configure this screen to mirror another screen.
The screen to mirror.
true on success.
Stop mirroring, restoring this screen to an independent display.
true on success.
Switch to the given display mode.
Pass 0 for scale or frequency to match any value.
Horizontal resolution in pixels.
Vertical resolution in pixels.
Backing scale factor (e.g. 2 for HiDPI, 1 for non-HiDPI). Pass 0 to ignore.
Refresh rate in Hz. Pass 0 to ignore.
true on success.
Move this screen so its top-left corner is at the given position in global Hammerspoon coordinates.
The X coordinate to move to
The Y coordinate to move to
true on success.
Designate this screen as the primary display (moves the menu bar here).
true on success.
Capture the current contents of this screen as an image. Requires Screen Recording permission.
Resolves with the captured image, or rejects if the capture fails (e.g. permission denied).
The nearest screen whose left edge is at or beyond this screen's right edge, or null.
An HSScreen object
The nearest screen that is physically above this screen, or null.
An HSScreen object
The nearest screen that is physically below this screen, or null.
An HSScreen object
The nearest screen whose right edge is at or before this screen's left edge, or null.
An HSScreen object
An object representing a single display attached to the system.
Coordinate system
All geometry is returned in Hammerspoon screen coordinates: the origin
(0, 0)is at the top-left of the primary display, andyincreases downward. This matches Hammerspoon v1 and is the inverse of the raw macOS/CoreGraphics convention.Examples