-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Hello! I've been interested in Hammerspoon but my knowledge of its APIs (and by extension of AXUIElement) is extremely limited. I've tried to piece together a small script that finds the text cursor location of an active textbox and then overlays information over it (right now it's just right-clicking)
Expected Behavior
AXPosition should return the X,Y coordinates of a text cursor in the active text box
Actual Behaviour
AXPosition returns the X,Y coordinates of the top left extreme of the active text box
Code used:
local ax = require("hs.axuielement")
hs.hotkey.bindSpec(
{{ "ctrl", "alt" }, "/"},
function()
local currentApp = hs.application.frontmostApplication()
local axApp = ax.applicationElement(currentApp)
axApp:setAttributeValue('AXEnhancedUserInterface', true)
axApp:setAttributeValue('AXManualAccessibility', true)
local systemElement = ax.systemWideElement()
local currentElement = systemElement:attributeValue("AXFocusedUIElement")
hs.eventtap.rightClick(currentElement:attributeValue("AXPosition"))
end
)
Resources
For the code snippet written above
System Information
macOS Catalina 10.15.7 (19H114)
AXUIElement: Version 1.0.8
Hammerspoon: Version 0.9.82 (5614)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels


