Skip to content

Latest commit

 

History

History
118 lines (97 loc) · 10.7 KB

File metadata and controls

118 lines (97 loc) · 10.7 KB

docs » cp.ui.Window


A Window UI element.

API Overview

  • Functions - API calls offered directly by the extension
  • matches
  • Constructors - API calls which return an object, typically one that offers API methods
  • new
  • Fields - Variables which can only be accessed from an object returned by a constructor
  • exists
  • focused
  • frame
  • fullScreen
  • hsWindow
  • id
  • minimized
  • UI
  • visible
  • Methods - API calls which can only be made on an object returned by a constructor
  • close
  • focus

API Documentation

Functions

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

Constructors

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

Signature cp.ui.Window.exists <cp.prop: boolean; read-only>
Type Field
Description Returns true if the window exists. It may not be visible.
Signature cp.ui.Window.focused <cp.prop: boolean>
Type Field
Description Is true if the window has mouse/keyboard focused.
Signature cp.ui.Window.frame <cp.prop: hs.geometry rect>
Type Field
Description The hs.geometry rect value describing the window's position.
Signature cp.ui.Window.fullScreen <cp.prop: boolean>
Type Field
Description Returns true if the window is full-screen.
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.
Signature cp.ui.Window.id <cp.prop: number; read-only>
Type Field
Description The unique ID for the window.
Signature cp.ui.Window.minimized <cp.prop: boolean>
Type Field
Description Returns true if the window exists and is minimised.
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.
Signature cp.ui.Window.visible <cp.prop: boolean; read-only>
Type Field
Description Returns true if the window is visible on a screen.

Methods

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