https://developer.apple.com/library/archive/samplecode/UIElementInspector/Introduction/Intro.html Provides information of AXUIElements under the cursor via Accessibility API introduced in Mac OS X version 10.2.
Example of such an app could be Apple's Accessibility Inspector. (Xcode > Open Developer Tool > Accessibility Inspector) https://developer.apple.com/documentation/accessibility/accessibility-inspector
Uses Apple's private framework AccessibilityAuditDeviceManager
internally.
AccessibilityAuditDeviceManager
can display Objective-C class under cursor.
It inspects AXClassName
attribute, which is only available for applications with
com.apple.private.accessibility.inspection
entitlement.
But most of the element under cursos attributes could still be obtained without this entitlement
https://developer.apple.com/documentation/coregraphics/quartz_event_services
Event taps make it possible to monitor and filter input events from several points within the system, prior to their delivery to a foreground application similar to Win32 SetWinEventHook()
Allows to synchroniously intercept, filter and substitute system wide events.
https://developer.apple.com/documentation/coregraphics/1454426-cgeventtapcreate
Create an even tap (aka event handler).
You have around 10ms to hande the event. After that event will receive event types -1
or -2
and won't be called any more.
kCGEventTapDisabledByTimeout = 0xFFFFFFFE, // -2
kCGEventTapDisabledByUserInput = 0xFFFFFFFF // -1
Example of swapping 'a' and 'z' keystrokes
- AX*
ApplicationServices.framework
, and it's subframeworkHIServices.framework
.ApplicationServices.framework
hasCoreGraphics.framework
as a dependency.
Returns an accessibility object that provides access to system attributes. This is useful for things like finding the focused accessibility object regardless of which application is currently active.
AXUIElement https://developer.apple.com/documentation/applicationservices/axuielement_h