Anyone using Hammerspoon?

Anyone here using Hammerspoon? Can it do anything Keyboard Maestro can’t?

2 Likes

Seems like a really cool scripting language for MacOS!

The major difference here is that Keyboard Maestro has a GUI (is drag and drop) while HammerSpoon seems to be purely code from my quick glance.

Based on that, I would say it can do just about everything Keyboard Maestro could do but requires that you have a deeper understanding when it comes to logic and coding :nerd_face:

#TimeToPlayAround!

Hi, I am not a Keyboard Maestro user, but I think it cannot create menubar entries, while Hammerspoon can.
https://www.hammerspoon.org/docs/hs.menubar.html

I am using hammerspoon quite a bit. The only time I wished I had Keyboard Maestro was the image recognition to automate clicking a button (whose functionality didn’t have a menubar item).

Otherwise they are pretty similar in functionality (I think). Like @Dillon_Carter said, hammerspoon is purely code, while keyboard Maestro is mainly graphical with the ability to execute code.

My entry to hammerspoon was the desire to create a hyperkey, which gives you another (or more) layer of keyboard shortcuts. If you’re interested check out Brett Tepstra‘s version, and then google some. I don‘t need Karabiner, for example, and there are a lot of quite elaborated setups.

Nope. Keyboard Maestro is the observable universe. It’s everything we’ve ever conceived of seeing. Hammerspoon is that plus the stuff that light hasn’t had sufficient time to travel for us to know it’s there. (Objective-C and Swift are dark matter and dark energy in this weird analogy.)

Could you be a little more, uh, concrete? I’m reluctant to invest the time and effort in learning a fairly obscure language unless I have a better idea of the payoff. @Nils mentioned menubar items (which I already create with Butler, and tbh probably have way too many of as it is). Anything else worth mentioning?

Come to think of it, maybe the question I really want to ask is not what HS can do that can’t be done in KM, but what it can do that can’t be done in AppleScript or AppleScriptObjectiveC.

If you think it’s a hassle, then it’s probably not for you :wink:

I never got to the point where I can just write an AppleScript, I always have to google because it is so quirky. Lua is also quite strange (coming from Python), but at least my first try is much closer to the final script.

I suggest you scroll through the Hammerspoon API and see if anything jumps out to you. Maybe even look at Spoons created by other users to get a feeling.
I‘d say that it is probably not so impressive, if you compare it to KM’s features. However, it you want to edit your automations in your favorite text editor, then definitely give it a try.

To give another (less metaphorical) take on @chri.sk’s answer, I’d like to quote from the docs

you can write Objective-C extensions to expose new areas of system functionality

so if that is your thing, then your Mac is the limit. Or you Objective-C skills…

I’ve been playing with hammerspoon recently. I love Keyboard Maestro, but I find I can get the AutoNation I need in hammerspoon much more quickly.

KM packs a lot into some of its action blocks, and I find it very uninintuitive sometimes the way a given block can do multiple fairly distinct things — figuring out how to get them to do what I want can be frustrating for me.

It helps that I do have experience writing code (mostly python, but also a little javascript, PhP, and some older languages like Basic and Tutor). Because lua is a compete language, if I can’t do something within hammerspoon itself, I can usually find a way to do it plain lua (even if that means just borrowing someone else’s function for list slicing or text splitting).

Anyway, if you like writing code more than moving visual blocks around, give hs a try. For now I’m using it alongside KM, but I find myself turning to it for new automations more and more.

1 Like