Live data from Hacker News

Hammerspoon

github.com

121–130 of 154 posts

Re: Hammerspoon

#121

Hammerspoon is the glue that holds my Mac together. For a starter list of things to do with this app, a partial list of the things that I'm using it for: - Dumping all open Safari tabs to an Obsidian doc - Adding 'hyper' (Ctrl-Opt-Cmd) keybinds to pop a new window for: - Safari - Finder - Terminal / Ghostty - VS Code - Notes - Editing Hammerspoon/AeroSpace/Sketchybar config - Reloading Hammerspoon config - Reloading…

Thanks for the examples. I was struggling to come up with ideas of how I’d use this.

Re: Hammerspoon

#123
This is more powerful than Mac’s own Automator tool, Lua is an interesting choice. Mac Automator used to only support AppleScript but now it supports JavaScriptCore from WebKit so you can run JavaScript with Mac Automator. This is what I do.

I’ll have a hell of a time rewriting everything into Lua when I have soooo many node packages I leverage.

Re: Hammerspoon

#124

Shameless plug/proud self-promotion - https://github.com/agzam/spacehammer "Spacemacs|Doom inspired Hammerspoon modal toolkit" I can't even work on Mac without it. It let's you do stuff like "alt+spc a b" (apps -> browser) or "alt+spc m j/k" (media -> vol up/down), or edit just about any text of any app in your editor (Emacs atm) - with all the tools you have there - spellchecking, thesaurus, translation, LLMs, etc.…

> "alt+cmd m j/k" (media -> vol up/down) if only keyboards came with built in buttons for adjusting the volume… oh wait. Unless of course you are suffering on a touch bar mac, then I completely understand.

My external mechanical keyboard doesn’t have media keys.

Re: Hammerspoon

#125
post #68

Hammerspoon maintainer here - I'm enjoying reading all the comments, and hoping that everyone isn't going to be annoyed that I'm mostly working on a v2 atm, which switches from Lua to JavaScript :D

> a v2 atm, which switches from Lua to JavaScript :D Presumably that'll be released in [checks calendar] 18 days?

Maybe not: https://www.reddit.com/r/hammerspoon/comments/1puln7j/110_re... https://github.com/cmsj/Hammerspoon2

Re: Hammerspoon

#126
As chance would have it, I just tried this for the first time as I wanted to bind a keyboard shortcut to an option from a menu bar app which doesn’t support keybinding. ChatGPT wrote a script which uses AppleScript to do it. Really anwesome, and excited to find more cool things to do with it!

Re: Hammerspoon

#127

Earlier quoted context omitted.

> a v2 atm, which switches from Lua to JavaScript :D Presumably that'll be released in [checks calendar] 18 days?

Maybe not: https://www.reddit.com/r/hammerspoon/comments/1puln7j/110_re... https://github.com/cmsj/Hammerspoon2

Well, I guess the motivation (use a more easily integrated extension language) makes sense but ugh, Javascript is a dirty sack of sewage.

I'd take a minor quibble with one of the Reddit commentators:

> "Lua is a language that was built for people that are not programmers, and Hammerspoon (or at least building it's extensions) is targeted specifically at programmers."

Hammerspoon[0] isn't targeted at programmers because it's abstracting hard things (interfacing with macOS system libraries, etc.) into easier ones (the Lua spoons) where accessibility to non-programmers is surely a goal.

[0] I'm excluding extensions because the included spoons cover many scenarios people would be interesting in using and, to be honest, building "extensions" to something as tricky as Hammerspoon would be beyond many programmers[1], never mind non-programmers.

[1] I'm reasonably experienced and pretty fast at the "huh? search experiment kludge test passable code" cycle even with completely new technologies and I definitely wouldn't be keen on attempting a Hammerspoon extension.

Re: Hammerspoon

#128
post #68

Hammerspoon maintainer here - I'm enjoying reading all the comments, and hoping that everyone isn't going to be annoyed that I'm mostly working on a v2 atm, which switches from Lua to JavaScript :D

>Hammerspoon maintainer .. Yay! :D >.. enjoying .. :) >Lua to JavaScript :\ Well, I have been a long user of Hammerspoon, and Lua, so thanks for the great app, it made a difference for me for a long time .. would be happy to hear why , but don’t feel obliged, the switch to JS over Lua, but anyway, thanks again!

The simple answer is not having to maintain a really complicated language bridge anymore.

The more complex answer is that Hammerspoon is currently about 100k lines of Objective C, and none of us really want to work on it anymore when Swift is the much nicer place to be doing macOS development.

Technically we could slowly convert in-place from ObjC to Swift, but there will always be a need for "LuaSkin", the bridging code we've accumulated over the last 13+ years, and rewriting that in Swift would be significantly complicated.

JavaScript, however, is already bridged for us because WebKit needs it.

Re: Hammerspoon

#129

Earlier quoted context omitted.

Maybe not: https://www.reddit.com/r/hammerspoon/comments/1puln7j/110_re... https://github.com/cmsj/Hammerspoon2

Well, I guess the motivation (use a more easily integrated extension language) makes sense but ugh, Javascript is a dirty sack of sewage. I'd take a minor quibble with one of the Reddit commentators: > "Lua is a language that was built for people that are not programmers, and Hammerspoon (or at least building it's extensions) is targeted specifically at programmers." Hammerspoon[0] isn't targeted at programmers becau…

I'll happily agree that JavaScript is not a very nice language, but to be honest, I don't think Lua is a very nice language either. It's easy to embed in C though, which is why we were able to do all of the things that Hammerspoon does.

Where JS massively wins here, to my mind, is that there is so much tooling available for it, to the point that I'm already not actually writing my v2 config in JS at all, I'm writing it in TypeScript and compiling it to JS.

Re: Hammerspoon

#130
post #82
post #68

Hammerspoon maintainer here - I'm enjoying reading all the comments, and hoping that everyone isn't going to be annoyed that I'm mostly working on a v2 atm, which switches from Lua to JavaScript :D

Thank you for your work on Hammerspoon! I’ve been using it for years. Would you mind elaborating on your vision for v2? Was there a certain limitation in the previous architecture that you’re trying to avoid this time around? Was there something in particular that drew you to choosing JavaScript for this version?

The limitation is entirely on the developer side - for years now there have only really been three of us working on Hammerspoon with any regularity, and that has been significantly dwindling down to mostly just me and Chris Hocking.

Honestly, in 2026, I do not want to be maintaining a 100k line Objective C program.

So, my current experimentation with a v2 is to see how easily I can catch up with where v1 is, just using Swift and JavaScriptCore.

There are lots of things about the Lua APIs that I don't like, and I'm addressing some of those as I go, but I'm currently in a phase where I'm targeting parity with everything I need for my v1 config, at which point I can cut over to running v2 and then see how things are looking and what can be refined/reworked.

Post reply on HN