Skip to content
asmagill edited this page Apr 11, 2020 · 1 revision

Coroutines and Hammerspoon

Coroutines are a Lua feature that has had a bit of a tumultuous history with Hammerspoon. As a somewhat advanced Lua construct, they have not been used directly until recently, and it was discovered that prior to Hammerspoon version 0.9.79, coroutines and Hammerspoon specific modules utilizing LuaSkin were fundamentally broken.

This has been addressed, but should be considered a work in progress -- if your attempts to use coroutines result in application crashes or (when you're lucky) a crashlog to the Hammerspoon console, please visit https://github.com/Hammerspoon/hammerspoon/issues and open a new issue with as much detail about what you are trying to do including specific Hammerspoon modules you are attempting to use within your coroutines.

To leverage coroutines in Hammerspoon witihn your own code to make it more responsive, please consult Leveraging Coroutines in Hammerspoon.

For those new to coroutines in general, please consult the following:

For those writing modules to extend Hammerspoon or just interested in the underlying problem and how it's been addressed within Hammerspoon, please consult: