#cp.ui.notifier
Supports long-lived 'AX' notifiers. Configure the application to watch, the function that provides the axuielement
and then register for the type of notification to watch, along with a function that will get triggered.
For example:
local notifier = require("cp.ui.notifier") local function finder() ... end -- returns the axuielement local o = notifier.new("com.apple.FinalCut", finder) o:watchFor("AXValueChanged", function(notifier, element, notification, details) ... end) o:start()
#API Overview
Functions - API calls offered directly by the extension
Constructors - API calls which return an object, typically one that offers API methods
Methods - API calls which can only be made on an object returned by a constructor
#API Documentation
#Functions
Signature | cp.ui.notifier.notifiersForBundleID(bundleID) -> table of cp.ui.notifier |
Type | Function |
Description | Returns the list of cp.ui.notifier instances that have been created for the specified Bundle ID . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/notifier.lua line 160 |
#Constructors
Signature | cp.ui.notifier.new(bundleID, elementFinderFn) -> cp.ui.notifier |
Type | Constructor |
Description | Creates a new cp.ui.notifier instance with the specified bundle ID and a function that returns the element being observed. |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/ui/notifier.lua line 126 |
#Methods
Signature | cp.ui.notifier:app() -> hs.application |
Type | Method |
Description | Returns the current hs.application instance for the app this notifier tracks. May be nil if the application is not running. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/notifier.lua line 294 |
Signature | cp.ui.notifier:bundleID() |
Type | Method |
Description | Returns the application 'bundle ID' that this notifier is tracking. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/notifier.lua line 281 |
Signature | cp.ui.notifier:currentElement() -> hs.axuielement |
Type | Method |
Description | Returns the current axuielement being observed. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/notifier.lua line 173 |
Signature | cp.ui.notifier:debugging([enabled]) -> boolean |
Type | Method |
Description | Enables/disables and reports current debugging status. When enabled, a message will be output for each known notification received. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/notifier.lua line 619 |
Signature | cp.ui.notifier:pid() -> number |
Type | Method |
Description | Returns the PID for the application being observed, or nil if it's not running. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/notifier.lua line 329 |
Signature | cp.ui.notifier:reset() -> self |
Type | Method |
Description | Resets the notifier |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/notifier.lua line 581 |
Signature | cp.ui.notifier:start() -> self |
Type | Method |
Description | Stops notifying watchers when events happen. |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/notifier.lua line 564 |
Signature | cp.ui.notifier:update([force]) -> self |
Type | Method |
Description | Updates any watchers to use the current axuielement . |
Parameters |
|
Returns |
|
Notes | None |
Examples | None |
Source | src/extensions/cp/ui/notifier.lua line 489 |
Signature | cp.ui.notifier:watchAll(callbackFn) -> self |
Type | Method |
Description | Registers the callback as a watcher for all standard notifications for the current axuielement . |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/ui/notifier.lua line 234 |
Signature | cp.ui.notifier:watchFor(notification, callbackFn) -> self |
Type | Method |
Description | Registers a function to get called whenever the specified notification type is triggered for the current axuielement . |
Parameters |
|
Returns |
|
Notes |
|
Examples | None |
Source | src/extensions/cp/ui/notifier.lua line 186 |