Documentation
¶
Index ¶
- func CheckAccessibilityPermissions() bool
- func GetClickableRoles() []string
- func GetScrollableRoles() []string
- func IsMissionControlActive() bool
- func PrintTree(node *TreeNode, depth int)
- func ReleaseAll(elements []*Element)
- func ScrollAtCursor(deltaX, deltaY int) error
- func SetClickableRoles(roles []string)
- func SetScrollableRoles(roles []string)
- type CachedInfo
- type Element
- func (e *Element) DoubleClick(restoreCursor bool) error
- func (e *Element) GetApplicationName() string
- func (e *Element) GetAttribute(name string) (string, error)
- func (e *Element) GetBundleIdentifier() string
- func (e *Element) GetChildren() ([]*Element, error)
- func (e *Element) GetInfo() (*ElementInfo, error)
- func (e *Element) GetMenuBar() *Element
- func (e *Element) GetScrollBounds() image.Rectangle
- func (e *Element) GoToPosition() error
- func (e *Element) IsClickable() bool
- func (e *Element) IsScrollable() bool
- func (e *Element) LeftClick(restoreCursor bool) error
- func (e *Element) LeftMouseDown() error
- func (e *Element) LeftMouseUp(isExit bool) error
- func (e *Element) MiddleClick(restoreCursor bool) error
- func (e *Element) Release()
- func (e *Element) RightClick(restoreCursor bool) error
- func (e *Element) SetFocus() error
- func (e *Element) TripleClick(restoreCursor bool) error
- type ElementInfo
- type InfoCache
- type TreeNode
- type TreeOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAccessibilityPermissions ¶
func CheckAccessibilityPermissions() bool
CheckAccessibilityPermissions checks if the app has accessibility permissions
func GetClickableRoles ¶
func GetClickableRoles() []string
GetClickableRoles returns the configured clickable roles.
func GetScrollableRoles ¶
func GetScrollableRoles() []string
GetScrollableRoles returns the configured scrollable roles.
func IsMissionControlActive ¶ added in v1.7.0
func IsMissionControlActive() bool
Check if is mission control is active Hopefully works on all OS versions Works on Tohoe 26.1 as of now
func PrintTree ¶
NOTE: This is a debugging function that prints the entire accessibility tree structure. Print the entire tree structure for debugging
func ReleaseAll ¶ added in v1.6.0
func ReleaseAll(elements []*Element)
ReleaseAll releases all elements in a slice
func ScrollAtCursor ¶ added in v1.7.0
func SetClickableRoles ¶
func SetClickableRoles(roles []string)
SetClickableRoles configures which accessibility roles are treated as clickable.
func SetScrollableRoles ¶
func SetScrollableRoles(roles []string)
SetScrollableRoles configures which accessibility roles are treated as scrollable.
Types ¶
type CachedInfo ¶ added in v1.5.0
type CachedInfo struct {
Info *ElementInfo
ExpiresAt time.Time
}
CachedInfo wraps ElementInfo with expiration time
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
Element represents an accessibility UI element
func GetAllWindows ¶
GetAllWindows returns all windows of the focused application
func GetApplicationByBundleID ¶
GetApplicationByBundleID returns an application element by bundle identifier
func GetApplicationByPID ¶
GetApplicationByPID returns an application element by its process ID
func GetElementAtPosition ¶
GetElementAtPosition returns the element at the specified screen position
func GetFocusedApplication ¶
func GetFocusedApplication() *Element
GetFocusedApplication returns the currently focused application
func GetFrontmostWindow ¶
func GetFrontmostWindow() *Element
GetFrontmostWindow returns the frontmost window
func GetSystemWideElement ¶
func GetSystemWideElement() *Element
GetSystemWideElement returns the system-wide accessibility element
func (*Element) DoubleClick ¶
DoubleClick performs a double-click action on the element
func (*Element) GetApplicationName ¶
GetApplicationName returns the application name
func (*Element) GetAttribute ¶
GetAttribute gets a custom attribute value
func (*Element) GetBundleIdentifier ¶
GetBundleIdentifier returns the bundle identifier
func (*Element) GetChildren ¶
GetChildren returns all child elements with optional occlusion checking
func (*Element) GetInfo ¶
func (e *Element) GetInfo() (*ElementInfo, error)
GetInfo returns information about the element
func (*Element) GetMenuBar ¶
GetMenuBar returns the menu bar element for the given application element
func (*Element) GetScrollBounds ¶
GetScrollBounds returns the scroll area bounds
func (*Element) GoToPosition ¶
GoToPosition performs a move mouse action to the element
func (*Element) IsClickable ¶
IsClickable checks if the element is clickable
func (*Element) IsScrollable ¶
IsClickable checks if the element is clickable
func (*Element) LeftMouseDown ¶ added in v1.7.0
LeftMouseDown performs a left-mouse-down action on the element
func (*Element) LeftMouseUp ¶ added in v1.7.0
LeftMouseUp performs a left-mouse-up action on the element
func (*Element) MiddleClick ¶
MiddleClick performs a middle-click action on the element
func (*Element) RightClick ¶
RightClick performs a right-click action on the element
func (*Element) TripleClick ¶ added in v1.7.0
TripleClick performs a triple-click action on the element
type ElementInfo ¶
type ElementInfo struct {
Position image.Point
Size image.Point
Title string
Role string
RoleDescription string
IsEnabled bool
IsFocused bool
PID int
}
ElementInfo contains information about a UI element
type InfoCache ¶ added in v1.5.0
type InfoCache struct {
// contains filtered or unexported fields
}
InfoCache is a thread-safe cache with TTL
func NewInfoCache ¶ added in v1.5.0
NewInfoCache creates a cache with the given TTL
func (*InfoCache) Get ¶ added in v1.5.0
func (c *InfoCache) Get(elem *Element) *ElementInfo
Get retrieves a cached value if it exists and hasn't expired
func (*InfoCache) Set ¶ added in v1.5.0
func (c *InfoCache) Set(elem *Element, info *ElementInfo)
Set stores a value with TTL
type TreeNode ¶
type TreeNode struct {
Element *Element
Info *ElementInfo
Children []*TreeNode
Parent *TreeNode
}
TreeNode represents a node in the accessibility tree
func BuildTree ¶
func BuildTree(root *Element, opts TreeOptions) (*TreeNode, error)
BuildTree builds an accessibility tree from the given root element
func GetClickableElements ¶
GetClickableElements returns all clickable elements in the frontmost window
func GetClickableElementsFromBundleID ¶ added in v1.5.0
func GetMenuBarClickableElements ¶
GetMenuBarClickableElements returns clickable elements from the focused app's menu bar
func GetScrollableElements ¶
GetScrollableElements returns all scrollable elements in the frontmost window
func (*TreeNode) FindClickableElements ¶
FindClickableElements finds all clickable elements in the tree
func (*TreeNode) FindScrollableElements ¶
FindScrollableElements finds all scrollable elements in the tree
type TreeOptions ¶
type TreeOptions struct {
FilterFunc func(*ElementInfo) bool
IncludeOutOfBounds bool
Cache *InfoCache
ParallelThreshold int
MaxParallelDepth int
}
TreeOptions configures tree traversal
func DefaultTreeOptions ¶
func DefaultTreeOptions() TreeOptions
DefaultTreeOptions returns default tree traversal options