hammerspoon2-docs
    Preparing search index...

    Class HSWindow

    Object representing a window. You should not instantiate these directly, but rather, use the methods in hs.window to create them for you. Note that this type uses private macOS APIs

    Index

    Constructors

    Properties

    application: HSApplication | null

    The application that owns this window

    frame: HSRect | null

    The window's frame {x: Int, y: Int, w: Int, h: Int}

    id: number

    The window's underlying ID. A value of 0 or -1 likely means no window ID could be determined.

    isFocused: boolean

    Whether the window is focused

    isFullscreen: boolean

    Whether the window is fullscreen

    isMinimized: boolean

    Whether the window is minimized

    isStandard: boolean

    Whether the window is standard (has a titlebar)

    isVisible: boolean

    Whether the window is visible (not minimized or hidden)

    pid: number

    The process ID of the application that owns this window

    position: HSPoint | null

    The window's position on screen {x: Int, y: Int}

    screen: HSScreen | null

    The screen that contains the largest portion of this window.

    size: HSSize | null

    The window's size {w: Int, h: Int}

    title: string | null

    The window's title

    Methods

    • Get the underlying AXElement

      Returns HSAXElement

      The accessibility element for this window

    • Center the window on the screen

      Returns void

    • Close this window

      Returns boolean

      true if successful

    • Focus this window

      Returns boolean

      true if successful

    • Minimize this window

      Returns boolean

      true if successful

    • Raise this window to the front

      Returns boolean

      true if successful

    • Toggle fullscreen mode

      Returns boolean

      true if successful

    • Unminimize this window

      Returns boolean

      true if successful