hs.window
Module
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
Hammerspoon 2/Modules/hs.window/HSWindowModule.swift:19
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
Hammerspoon 2/Modules/hs.window/HSWindowModule.swift:23
Declaration
hs.window.allWindows() -> HSWindow[]
Parameters
None
Return Value
An array of all windows
hs.window.visibleWindows
Get all visible (not minimized) windows
Hammerspoon 2/Modules/hs.window/HSWindowModule.swift:27
Declaration
hs.window.visibleWindows() -> HSWindow[]
Parameters
None
Return Value
An array of visible windows
hs.window.windowsForApp
Get windows for a specific application
Hammerspoon 2/Modules/hs.window/HSWindowModule.swift:32
Declaration
hs.window.windowsForApp(app) -> HSWindow[]
Parameters
-
appHSApplicationAn HSApplication object
Return Value
An array of windows for that application
hs.window.windowsOnScreen
Get all windows on a specific screen
Hammerspoon 2/Modules/hs.window/HSWindowModule.swift:37
Declaration
hs.window.windowsOnScreen(screenIndex) -> HSWindow[]
Parameters
-
screenIndexnumberThe 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
Hammerspoon 2/Modules/hs.window/HSWindowModule.swift:43
Declaration
hs.window.windowAtPoint(point) -> HSWindow
Parameters
-
pointHSPointAn 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)
Hammerspoon 2/Modules/hs.window/HSWindowModule.swift:47
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
Hammerspoon 2/Modules/hs.window/hs.window.js:12
Declaration
hs.window.findByTitle(title) -> any
Parameters
-
titleanyThe 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
Hammerspoon 2/Modules/hs.window/hs.window.js:21
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
Hammerspoon 2/Modules/hs.window/hs.window.js:32
Declaration
hs.window.moveToLeftHalf(win) -> any
Parameters
-
winanyAn 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
Hammerspoon 2/Modules/hs.window/hs.window.js:53
Declaration
hs.window.moveToRightHalf(win) -> any
Parameters
-
winanyAn HSWindow object
Return Value
True if the operation was successful, otherwise False
hs.window.maximize
Maximize a window Parameter win: An HSWindow object
Hammerspoon 2/Modules/hs.window/hs.window.js:75
Declaration
hs.window.maximize(win) -> any
Parameters
-
winanyAn HSWindow object
Return Value
True if the operation was successful, otherwise false
hs.window.cycleWindows
SKIP_DOCS
Hammerspoon 2/Modules/hs.window/hs.window.js:93
Declaration
hs.window.cycleWindows() -> None
Parameters
None
Return Value
None