Inspect/manipulate windows
Notes:
hs.screen
and hs.geometry
for more information on how Hammerspoon uses window/screen frames and coordinatesSignature | hs.window.animationDuration (number) |
---|---|
Type | Variable |
Description | The default duration for animations, in seconds. Initial value is 0.2; set to 0 to disable animations. |
Source | extensions/window/window.lua line 21 |
Signature | hs.window.setFrameCorrectness |
---|---|
Type | Variable |
Description | Using |
Source | extensions/window/window.lua line 392 |
Signature | hs.window.allWindows() -> list of hs.window objects |
---|---|
Type | Function |
Description | Returns all windows |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/window.lua line 54 |
Signature | hs.window.desktop() -> hs.window object |
---|---|
Type | Function |
Description | Returns the desktop "window" |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/window.lua line 33 |
Signature | hs.window.invisibleWindows() -> list of hs.window objects |
---|---|
Type | Function |
Description | Gets all invisible windows |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 139 |
Signature | hs.window.list(allWindows) -> table |
---|---|
Type | Function |
Description | Gets a table containing all the window data retrieved from |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/libwindow.m line 21 |
Signature | hs.window.minimizedWindows() -> list of hs.window objects |
---|---|
Type | Function |
Description | Gets all minimized windows |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 156 |
Signature | hs.window.orderedWindows() -> list of hs.window objects |
---|---|
Type | Function |
Description | Returns all visible windows, ordered from front to back |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 173 |
Signature | hs.window.setShadows(shadows) |
---|---|
Type | Function |
Description | Enables/Disables window shadows |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/libwindow.m line 563 |
Signature | hs.window.snapshotForID(ID [, keepTransparency]) -> hs.image-object |
---|---|
Type | Function |
Description | Returns a snapshot of the window specified by the ID as an |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/libwindow.m line 589 |
Signature | hs.window.timeout(value) -> boolean |
---|---|
Type | Function |
Description | Sets the timeout value used in the accessibility API. |
Parameters |
|
Returns |
|
Source | extensions/window/libwindow.m line 65 |
Signature | hs.window.visibleWindows() -> list of hs.window objects |
---|---|
Type | Function |
Description | Gets all visible windows |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 122 |
Signature | hs.window.find(hint) -> hs.window object(s) |
---|---|
Type | Constructor |
Description | Finds windows |
Parameters |
|
Returns |
|
Notes |
Usage:
|
Source | extensions/window/window.lua line 208 |
Signature | hs.window.focusedWindow() -> window |
---|---|
Type | Constructor |
Description | Returns the window that has keyboard/mouse focus |
Parameters |
|
Returns |
|
Source | extensions/window/libwindow.m line 94 |
Signature | hs.window.frontmostWindow() -> hs.window object |
---|---|
Type | Constructor |
Description | Returns the focused window or, if no window has focus, the frontmost one |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 748 |
Signature | hs.window.get(hint) -> hs.window object |
---|---|
Type | Constructor |
Description | Gets a specific window |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/window.lua line 189 |
Signature | hs.window:application() -> app or nil |
---|---|
Type | Method |
Description | Gets the |
Parameters |
|
Returns |
|
Source | extensions/window/libwindow.m line 482 |
Signature | hs.window:becomeMain() -> window |
---|---|
Type | Method |
Description | Makes the window the main window of its application |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/libwindow.m line 500 |
Signature | hs.window:centerOnScreen([screen][, ensureInScreenBounds][, duration]) --> hs.window object |
---|---|
Type | Method |
Description | Centers the window on a screen |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 864 |
Signature | hs.window:close() -> bool |
---|---|
Type | Method |
Description | Closes the window |
Parameters |
|
Returns |
|
Source | extensions/window/libwindow.m line 324 |
Signature | hs.window:focus() -> hs.window object |
---|---|
Type | Method |
Description | Focuses the window |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 508 |
Signature | hs.window:focusTab(index) -> bool |
---|---|
Type | Method |
Description | Focuses the tab in the window's tab group at index, or the last tab if index is out of bounds |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/libwindow.m line 341 |
Signature | hs.window:focusWindowEast([candidateWindows[, frontmost[, strict]]]) -> boolean |
---|---|
Type | Method |
Description | Focuses the nearest possible window to the east (i.e. right) |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/window.lua line 783 |
Signature | hs.window:focusWindowNorth([candidateWindows[, frontmost[, strict]]]) -> boolean |
---|---|
Type | Method |
Description | Focuses the nearest possible window to the north (i.e. up) |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/window.lua line 823 |
Signature | hs.window:focusWindowSouth([candidateWindows[, frontmost[, strict]]]) -> boolean |
---|---|
Type | Method |
Description | Focuses the nearest possible window to the south (i.e. down) |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/window.lua line 843 |
Signature | hs.window:focusWindowWest([candidateWindows[, frontmost[, strict]]]) -> boolean |
---|---|
Type | Method |
Description | Focuses the nearest possible window to the west (i.e. left) |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/window.lua line 803 |
Signature | hs.window:frame() -> hs.geometry rect |
---|---|
Type | Method |
Description | Gets the frame of the window in absolute coordinates |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 430 |
Signature | hs.window:id() -> number or nil |
---|---|
Type | Method |
Description | Gets the unique identifier of the window |
Parameters |
|
Returns |
|
Source | extensions/window/libwindow.m line 546 |
Signature | hs.window:isFullScreen() -> bool or nil |
---|---|
Type | Method |
Description | Gets the fullscreen state of the window |
Parameters |
|
Returns |
|
Source | extensions/window/libwindow.m line 400 |
Signature | hs.window:isMaximizable() -> bool or nil |
---|---|
Type | Method |
Description | Determines if a window is maximizable |
Parameters |
|
Returns |
|
Source | extensions/window/libwindow.m line 296 |
Signature | hs.window:isMinimized() -> bool |
---|---|
Type | Method |
Description | Gets the minimized state of the window |
Parameters |
|
Returns |
|
Source | extensions/window/libwindow.m line 456 |
Signature | hs.window:isStandard() -> bool |
---|---|
Type | Method |
Description | Determines if the window is a standard window |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/libwindow.m line 164 |
Signature | hs.window:isVisible() -> boolean |
---|---|
Type | Method |
Description | Determines if a window is visible (i.e. not hidden and not minimized) |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/window.lua line 243 |
Signature | hs.window:maximize([duration]) -> hs.window object |
---|---|
Type | Method |
Description | Maximizes the window |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/window.lua line 581 |
Signature | hs.window:minimize() -> window |
---|---|
Type | Method |
Description | Minimizes the window |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/libwindow.m line 417 |
Signature | hs.window:move(rect[, screen][, ensureInScreenBounds][, duration]) --> hs.window object |
---|---|
Type | Method |
Description | Moves the window |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 930 |
Signature | hs.window:moveOneScreenEast([noResize, ensureInScreenBounds][, duration]) -> hs.window object |
---|---|
Type | Method |
Description | Moves the window one screen east (i.e. right) |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 969 |
Signature | hs.window:moveOneScreenNorth([noResize, ensureInScreenBounds][, duration]) -> hs.window object |
---|---|
Type | Method |
Description | Moves the window one screen north (i.e. up) |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 995 |
Signature | hs.window:moveOneScreenSouth([noResize, ensureInScreenBounds][, duration]) -> hs.window object |
---|---|
Type | Method |
Description | Moves the window one screen south (i.e. down) |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 1009 |
Signature | hs.window:moveOneScreenWest([noResize, ensureInScreenBounds][, duration]) -> hs.window object |
---|---|
Type | Method |
Description | Moves the window one screen west (i.e. left) |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 982 |
Signature | hs.window:moveToScreen(screen[, noResize, ensureInScreenBounds][, duration]) -> hs.window object |
---|---|
Type | Method |
Description | Moves the window to a given screen, retaining its relative position and size |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 904 |
Signature | hs.window:moveToUnit(unitrect[, duration]) -> hs.window object |
---|---|
Type | Method |
Description | Moves and resizes the window to occupy a given fraction of the screen |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/window.lua line 887 |
Signature | hs.window:otherWindowsAllScreens() -> list of hs.window objects |
---|---|
Type | Method |
Description | Gets every window except this one |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 493 |
Signature | hs.window:otherWindowsSameScreen() -> list of hs.window objects |
---|---|
Type | Method |
Description | Gets other windows on the same screen |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 479 |
Signature | hs.window:raise() -> window |
---|---|
Type | Method |
Description | Brings a window to the front of the screen without focussing it |
Parameters |
|
Returns |
|
Source | extensions/window/libwindow.m line 521 |
Signature | hs.window:role() -> string |
---|---|
Type | Method |
Description | Gets the role of the window |
Parameters |
|
Returns |
|
Source | extensions/window/libwindow.m line 147 |
Signature | hs.window:screen() -> hs.screen object |
---|---|
Type | Method |
Description | Gets the screen which the window is on |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/window.lua line 618 |
Signature | hs.window:sendToBack() -> hs.window object |
---|---|
Type | Method |
Description | Sends the window to the back |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/window.lua line 539 |
Signature | hs.window:setFrame(rect[, duration]) -> hs.window object |
---|---|
Type | Method |
Description | Sets the frame of the window in absolute coordinates |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 368 |
Signature | hs.window:setFrameInScreenBounds([rect][, duration]) -> hs.window object |
---|---|
Type | Method |
Description | Sets the frame of the window in absolute coordinates, possibly adjusted to ensure it is fully inside the screen |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 412 |
Signature | hs.window:setFrameWithWorkarounds(rect[, duration]) -> hs.window object |
---|---|
Type | Method |
Description | Sets the frame of the window in absolute coordinates, using the additional workarounds described in |
Parameters |
|
Returns |
|
Source | extensions/window/window.lua line 380 |
Signature | hs.window:setFullScreen(fullscreen) -> window |
---|---|
Type | Method |
Description | Sets the fullscreen state of the window |
Parameters |
|
Returns |
|
Source | extensions/window/libwindow.m line 382 |
Signature | hs.window:setSize(size) -> window |
---|---|
Type | Method |
Description | Resizes the window |
Parameters |
|
Returns |
|
Source | extensions/window/libwindow.m line 239 |
Signature | hs.window:setTopLeft(point) -> window |
---|---|
Type | Method |
Description | Moves the window to a given point |
Parameters |
|
Returns |
|
Source | extensions/window/libwindow.m line 218 |
Signature | hs.window:size() -> size |
---|---|
Type | Method |
Description | Gets the size of the window |
Parameters |
|
Returns |
|
Source | extensions/window/libwindow.m line 201 |
Signature | hs.window:snapshot([keepTransparency]) -> hs.image-object |
---|---|
Type | Method |
Description | Returns a snapshot of the window as an |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/libwindow.m line 611 |
Signature | hs.window:subrole() -> string |
---|---|
Type | Method |
Description | Gets the subrole of the window |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/libwindow.m line 127 |
Signature | hs.window:tabCount() -> number or nil |
---|---|
Type | Method |
Description | Gets the number of tabs in the window has |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/libwindow.m line 362 |
Signature | hs.window:title() -> string |
---|---|
Type | Method |
Description | Gets the title of the window |
Parameters |
|
Returns |
|
Source | extensions/window/libwindow.m line 110 |
Signature | hs.window:toggleFullScreen() -> hs.window object |
---|---|
Type | Method |
Description | Toggles the fullscreen state of the window |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/window.lua line 597 |
Signature | hs.window:toggleZoom() -> window |
---|---|
Type | Method |
Description | Toggles the zoom state of the window (this is effectively equivalent to clicking the green maximize/fullscreen button at the top left of a window) |
Parameters |
|
Returns |
|
Source | extensions/window/libwindow.m line 257 |
Signature | hs.window:topLeft() -> point |
---|---|
Type | Method |
Description | Gets the absolute co-ordinates of the top left of the window |
Parameters |
|
Returns |
|
Source | extensions/window/libwindow.m line 184 |
Signature | hs.window:unminimize() -> window |
---|---|
Type | Method |
Description | Un-minimizes the window |
Parameters |
|
Returns |
|
Source | extensions/window/libwindow.m line 438 |
Signature | hs.window:windowsToEast([candidateWindows[, frontmost[, strict]]]) -> list of hs.window objects |
---|---|
Type | Method |
Description | Gets all windows to the east of this window |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/window.lua line 688 |
Signature | hs.window:windowsToNorth([candidateWindows[, frontmost[, strict]]]) -> list of hs.window objects |
---|---|
Type | Method |
Description | Gets all windows to the north of this window |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/window.lua line 718 |
Signature | hs.window:windowsToSouth([candidateWindows[, frontmost[, strict]]]) -> list of hs.window objects |
---|---|
Type | Method |
Description | Gets all windows to the south of this window |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/window.lua line 733 |
Signature | hs.window:windowsToWest([candidateWindows[, frontmost[, strict]]]) -> list of hs.window objects |
---|---|
Type | Method |
Description | Gets all windows to the west of this window |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/window.lua line 703 |
Signature | hs.window:zoomButtonRect() -> rect-table or nil |
---|---|
Type | Method |
Description | Gets a rect-table for the location of the zoom button (the green button typically found at the top left of a window) |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/window/libwindow.m line 275 |