Live data from Hacker News

Hammerspoon

github.com

141–150 of 154 posts

Re: Hammerspoon

#141
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

why not both? JS is a pragmatic choice 100x more devs understand though.

Re: Hammerspoon

#142
post #129

Earlier quoted context omitted.

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…

Firstly, thanks for all the Hammerspoon work - it is a marvellous thing (and I'd love Apple to support something like it as an extension to OSA.)

> Where JS massively wins here, to my mind, is that there is so much tooling available for it

Yeah, I can see that being a big win for development and people already invested in the JS ecosystem.

(I'll stick with Hammerspoon v1 until it breaks and then figure something else out because it'll be a cold day in hell before I subject myself to JS/Node/Typescript again. The trauma runs deep and wide.)

> I'm already not actually writing my v2 config in JS at all, I'm writing it in TypeScript

Will give v2 a go with `lua2js`[0] transliteration and see if that's workable.

[0] https://github.com/xiangnanscu/lua2js

Re: Hammerspoon

#143
post #38

Earlier quoted context omitted.

make caps lock control on hold, double quote on tap. Make control hyperkey on hold, angle bracket on tap. My keyboard firmware is very odd. This is not easily done with soft remaps to the point that I don't bother trying.

If you're on macOS have you tried Karabiner Elements? It seems to do just fine with software mapping my macbook keyboard.

I do use it. Before the way config worked changed I had hold/tap control/double-quote working. But they changed the way config works and I didn’t bother to fix that because I made a keyboard that does what I want exactly and when I’m on my laptop keyboard I don’t care toooo much.

Re: Hammerspoon

#144
This might be a dumb quesiton but ... do you think AppleScript was a mistake on Apple's part? My understanding is MacOS has had automation via AppleScript forever, but everytime I've used it the syntax is inscrutable. It feels like if they had chosen Python or JavaScript or Lua we'd see much more automation over the last 20+ years. Is Hammerspoon filling that gap?

Re: Hammerspoon

#145
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

Do you plan to keep v1 for a while or to provide a way to translate all the current spoons for v2?

v1 won't stop working until Apple breaks something it relies on, and there may be interested community people who step up to take over maintenance.

Re: Hammerspoon

#146

Earlier quoted context omitted.

How does Hammerspoon help with this? Seems like just AppleScript and bash. Also if I may ask, how do you like Obsidian? I had never heard of it until now. Seems like a competitor to the Notes feature of iOS/macOS, but with its own subscription for syncing independently of iCloud?

I mean, in this case, the Hammerspoon part is really just the hyper keybind and the easy run of AppleScript text inline. But... once you've got some stuff going, it's easier to hook into Hammerspoon as the "frontend" for other things as your systems grow. Obsidian is good! This use of Bases is really my only "proprietary" use of anything Obsidian-specific. The rest is a combo of personal reference, brainstorms, intri…

Ah. Given the context, I had assumed it relied more on hammerspoon and less on applescript. I'm a bit less excited about it than I was, but I'll still look into doing similar sometime since I'm a habitual tab-opener.

Re: Hammerspoon

#147
post #146

Earlier quoted context omitted.

I mean, in this case, the Hammerspoon part is really just the hyper keybind and the easy run of AppleScript text inline. But... once you've got some stuff going, it's easier to hook into Hammerspoon as the "frontend" for other things as your systems grow. Obsidian is good! This use of Bases is really my only "proprietary" use of anything Obsidian-specific. The rest is a combo of personal reference, brainstorms, intri…

Ah. Given the context, I had assumed it relied more on hammerspoon and less on applescript. I'm a bit less excited about it than I was, but I'll still look into doing similar sometime since I'm a habitual tab-opener.

FWIW, if you prefer Lua, all of that could be accomplished with it instead of Bash. You'd probably still call out to Chrome for those bits.

Re: Hammerspoon

#148
post #119
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

Hmm I already avoid Lua by writing in Fennel, I’ll probably avoid the JS by writing… what Lisp compiles to JS, ClojureScript?

Cljs setup for this case probably would require a bit of scaffolding. While using https://github.com/squint-cljs/squint perhaps would be pretty straightforward. Albeit you're gonna lose the type-safety guarantees - Clojure is strongly typed, and Clojurescript sometimes emits safer code than Typescript does (TS removes all the type-related data from the compiled .js code, while Cljs keeps the runtime checks in place). Squint afaik is much closer to Javascript in that respect.

Re: Hammerspoon

#149
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

why not both? JS is a pragmatic choice 100x more devs understand though.

> 100x more devs understand though

Things programmers believe. It's interesting how some knowledge fundamentally assumed by default. For whatever reasons, the notion is widespread. You're a programmer? Therefore you must know JS, SQL, Bash and Python. In practice, what I've found after decades working with various teams - most programmers have pretty inadequate knowledge of any of these things.

Re: Hammerspoon

#150
post #119

Earlier quoted context omitted.

Hmm I already avoid Lua by writing in Fennel, I’ll probably avoid the JS by writing… what Lisp compiles to JS, ClojureScript?

Cljs setup for this case probably would require a bit of scaffolding. While using https://github.com/squint-cljs/squint perhaps would be pretty straightforward. Albeit you're gonna lose the type-safety guarantees - Clojure is strongly typed, and Clojurescript sometimes emits safer code than Typescript does (TS removes all the type-related data from the compiled .js code, while Cljs keeps the runtime checks in place).…

That's cool, I hadn't heard of Squint, thanks! Looks lightweight. Another compile-to-js option that seems good is Gleam.
Post reply on HN