I wasn't that desperate to switch from Phoenix to a new window manager, but my interest was piqued by Hammerspoon's ability to draw on the desktop or in floating widgets. Replacing Phoenix turned out to be easy, however, as Hammerspoon comes with most of the features I'd built myself in Phoenix. The one hiccup was figuring out how to configure Hammerspoon with Fennel instead of Lua.
At first I tried just editing
init.fnl and running a watcher to automatically compile to Lua on changes, but Hammerspoon's suggested auto-reloading code wouldn't pick up the changes, and I suspect Bash's redirection to write the file truncated it and caused Hammerspoon to lose the file handle.
The solution, mined from someone's GitHub code, is to embed Fennel:
package.path = package.path .. ";" .. os.getenv("HOME") .. "/.hammerspoon/?.lua" fennel = require('fennel') fennel.path = package.path .. ";" .. os.getenv("HOME") .. "/.hammerspoon/?.fnl" table.insert(package.loaders or package.searchers, fennel.searcher) require 'main'
In the code above,
main refers to
main.fnl, which is compiled to Lua on import.
init.lua, I haven't had any trouble automatically reloading
main.fnl when it changes.