Closed megalithic closed 4 years ago
Ok, so if I'm following correctly, you were finally able to compile Hammerspoon and get this to work?
I do want to apologize about the current state of the axuielement module examples... I'm in the process of cleaning things up and making the module take advantage of the fact that the upcoming release of Hammerspoon (or development build, if you have XCode) properly supports coroutines... because most applications that utilize the accessibility features have literally hundreds if not thousands of accessibility elements within them, things can get really slow and prior to fixing coroutines, this meant potentially blocking behavior within Hammerspoon which slowed everything down. However, to properly utilize coroutines, the search and filter methods have to be written to use a callback to notify you when they have completed.
The core functionality is solid, so if you know what elements you're looking for it works well... for example, since application menu items are always in the "AXMenuBar" attribute which is a direct child of the application element itself, this code can replace hs.application:getMenuItems
and it doesn't lock up Hammerspoon while grabbing the items.
What currently doesn't work are the exploratory queries in some of the module support documents, though I hope to fix those and update the examples over the next couple of days.
First of all, thank you so much for providing these libraries for us to use with Hammerspoon, @asmagill!!
I'm on macOS Catalina 10.15.4, and Hammerspoon version 0.9.78 (5164).
I'm just using the pre-compiled binary, extracting to my ~/.hammerspoon directory and referencing like so:
local axuiWindowElement = require('hs._asm.axuielement').windowElement
for getting attributeValues.I also am unable to
make install
successfully from source. I have the latest XCode (from the App Store) and command-line tools installed, too.I saw many of the posts about coroutines in Lua/LuaSkin, but not seeing a way, for the lay-person to get these sorts of things working.
Might you have any insight?
Thanks again @asmagill!
Here's the error output from the Hammerspoon console with the aforementioned require added to my
~/.hammerspoon/init.lua
:UPDATE
Closing.. building Hammerspoon in debug seemed to do the trick; further reading about the coroutines and
LuaSkin sharedWithState
changes shows that I need 0.9.79+ (or build Hammerspoon locally).