Module for interacting with windows

Types

This module provides the following types:

Properties

This module has no properties.

Methods

hs.window.focusedWindow

Get the currently focused window


Declaration

hs.window.focusedWindow() -> HSWindow

Parameters

None

Return Value

The focused window, or nil if none

hs.window.allWindows

Get all windows from all applications


Declaration

hs.window.allWindows() -> HSWindow[]

Parameters

None

Return Value

An array of all windows

hs.window.visibleWindows

Get all visible (not minimized) windows


Declaration

hs.window.visibleWindows() -> HSWindow[]

Parameters

None

Return Value

An array of visible windows

hs.window.windowsForApp

Get windows for a specific application


Declaration

hs.window.windowsForApp(app) -> HSWindow[]

Parameters

  • app HSApplication

    An HSApplication object

Return Value

An array of windows for that application

hs.window.windowsOnScreen

Get all windows on a specific screen


Declaration

hs.window.windowsOnScreen(screenIndex) -> HSWindow[]

Parameters

  • screenIndex number

    The screen index (0 for main screen)

Return Value

An array of windows on that screen

hs.window.windowAtPoint

Get the window at a specific screen position


Declaration

hs.window.windowAtPoint(point) -> HSWindow

Parameters

  • point HSPoint

    An HSPoint containing the coordinates

Return Value

The topmost window at that position, or nil if none

hs.window.orderedWindows

Get ordered windows (front to back)


Declaration

hs.window.orderedWindows() -> HSWindow[]

Parameters

None

Return Value

An array of windows in z-order

hs.window.findByTitle

Find windows by title Parameter title: The window title to search for. All windows with titles that include this string, will be matched


Declaration

hs.window.findByTitle(title) -> any

Parameters

  • title any

    The window title to search for. All windows with titles that include this string, will be matched

Return Value

An array of HSWindow objects with matching titles

hs.window.currentWindows

Get all windows for the current application


Declaration

hs.window.currentWindows() -> any

Parameters

None

Return Value

An array of HSWindow objects

hs.window.moveToLeftHalf

Move a window to left half of screen Parameter win: An HSWindow object


Declaration

hs.window.moveToLeftHalf(win) -> any

Parameters

  • win any

    An HSWindow object

Return Value

True if the operation was successful, otherwise False

hs.window.moveToRightHalf

Move a window to right half of screen Parameter win: An HSWindow object


Declaration

hs.window.moveToRightHalf(win) -> any

Parameters

  • win any

    An HSWindow object

Return Value

True if the operation was successful, otherwise False

hs.window.maximize

Maximize a window Parameter win: An HSWindow object


Declaration

hs.window.maximize(win) -> any

Parameters

  • win any

    An HSWindow object

Return Value

True if the operation was successful, otherwise false

hs.window.cycleWindows

SKIP_DOCS


Declaration

hs.window.cycleWindows() -> None

Parameters

None

Return Value

None