docs » cp.ui.Window


A Window UI element.

API Overview

API Documentation

Functions

matches

Signature cp.ui.Window.matches(element) -> boolean
Type Function
Description Checks if the provided element is a valid window.

Constructors

new

Signature cp.ui.Window:new(finderFn) -> Window
Type Constructor
Description Creates a new Window
Parameters
  • `finderFn` - a function which will provide the `axuielement` for the window to work with.
Returns
  • A new `Window` instance.

Fields

exists

Signature cp.ui.Window.exists <cp.prop: boolean; read-only>
Type Field
Description Returns true if the window exists. It may not be visible.

focused

Signature cp.ui.Window.focused <cp.prop: boolean>
Type Field
Description Is true if the window has mouse/keyboard focused.

frame

Signature cp.ui.Window.frame <cp.prop: hs.geometry rect>
Type Field
Description The hs.geometry rect value describing the window's position.

fullScreen

Signature cp.ui.Window.fullScreen <cp.prop: boolean>
Type Field
Description Returns true if the window is full-screen.

hsWindow

Signature cp.ui.Window.hsWindow <cp.prop: hs.window; read-only>
Type Field
Description The hs.window instance for the window, or nil if it can't be found.

id

Signature cp.ui.Window.id <cp.prop: number; read-only>
Type Field
Description The unique ID for the window.

minimized

Signature cp.ui.Window.minimized <cp.prop: boolean>
Type Field
Description Returns true if the window exists and is minimised.

UI

Signature cp.ui.Window.UI <cp.prop: axuielement; read-only>
Type Field
Description Returns the axuielement UI for the window, or nil if it can't be found.

visible

Signature cp.ui.Window.visible <cp.prop: boolean; read-only>
Type Field
Description Returns true if the window is visible on a screen.

Methods

close

Signature cp.ui.Window.close() -> boolean
Type Method
Description Attempts to close the window.
Parameters
  • * None
Returns
  • * `true` if the window was successfully closed.

focus

Signature cp.ui.Window.focus() -> boolean
Type Method
Description Attempts to focus the window.
Parameters
  • * None
Returns
  • * `true` if the window was successfully focused.

snapshot

Signature `cp.ui.Window:snapshot([path]) -> hs.image nil` </span>
Type Method
Description Takes a snapshot of the UI in its current state as a PNG and returns it.
Parameters
  • * path - (optional) The path to save the file. Should include the extension (should be `.png`).

results matching ""

    No results matching ""