hammerspoon2-docs
    Preparing search index...

    Namespace ax

    Accessibility API Module

    // Get the focused UI element
    const element = hs.ax.focusedElement();
    console.log(element.role, element.title);

    // Watch for window creation events
    const app = hs.application.frontmost();
    hs.ax.addWatcher(app, "AXWindowCreated", (notification, element) => {
    console.log("New window:", element.title);
    });

    Note:* Requires accessibility permissions in System Preferences.

    Variables

    notificationTypes

    Functions

    addWatcher
    applicationElement
    elementAtPoint
    findByRole
    findByTitle
    focusedElement
    printHierarchy
    removeWatcher
    systemWideElement
    windowElement