Live data from Hacker News

Hammerspoon

github.com

131–140 of 154 posts

Re: Hammerspoon

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

Will this lead to some synergy with AppleScript, which added JavaScript a few years ago?

Not really any more or less than in v1 - which is to say that it's possible to execute those scripts from Hammerspoon, but there's no rich bridging between them.

Re: Hammerspoon

#132
post #101
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

Can't wait for the JS switch! Personally, it's having to figure out Lua is what's kept me away from it... :)

Would it then interest you to know that the build process for v2 ships a hammerspoon.d.ts with the app? :)

Re: Hammerspoon

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

I love Hammerspoon!! here's my one handed shortcuts for window control across multiple monitors: https://gist.github.com/pazimzadeh/b1c70f5f205d0b63264e7c021... What will v2 enable??

Really there's very little that v2 might do, that v1 couldn't. This is almost all about me not wanting to maintain a big pile of Objective C and Lua anymore. I want to be working in Swift, and rather than maintain our own type bridging to/from Lua, we can get that for free from Apple's JavaScriptCore framework.

Beyond my enjoyment/productivity on the developer side though, I think v2 will be a big boost to user enjoyment/productivity, mostly because they'll be able to get much nicer IDE integrations for their config file, and be able to do things like write their config in TypeScript.

Re: Hammerspoon

#134
post #73
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

I'm curious if the switch was for dev ergonomics or the mindshare of the languages?

Mostly the former, but the latter is also attractive. Once I got the basic core working and a couple of modules implemented, I had Claude build me a script that extracts type information and method signatures, to automatically build a TypeScript definition file.

I have a feeling that letting people do what Hammerspoon can do, but in a TypeScript environment that they're much more likely to know, than Lua, will be huge for the project.

Re: Hammerspoon

#135
post #90
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

Have you though of some more modern language agnostic solution like wasm plugins users could write in anything, with the help of typed languages if they like? Or is that not feasible for a scripting project like this?

I expect that is possible, but the specific choice of JavaScript is because Apple ships a framework that bridges types very nicely between native and JS. It's used by WebKit, so it works really well and is very unlikely to disappear.

That means the core of Hammerspoon goes from being incredibly complicated, to really just a protocol conformance.

Re: Hammerspoon

#136
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?

Re: Hammerspoon

#137
post #128

Earlier quoted context omitted.

>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…

Ah .. all perfectly good reasoning imho, thanks for the info.

Re: Hammerspoon

#138
post #3

here is my entire config hs.hotkey.bind({"ctrl"}, "D", function() hs.grid.show() end) i've tried all of the other fancy window managers and for me nothing has ever beat the ease of use of just (1) ctrl-d to see the grid, (2) type the letter where you want the top left corner of your window to be, (3) type the letter where you want the bottom right corner to be window resized

This is amazing. Thanks for sharing. Did you ever look into capturing the states of where all the windows are once you are done with resizing them? So as to restore them later back into position if they ever get out of alignment ?

Thinking of the usecase where every task or a project deserves a certain arrangement of windows and it would be good to summon them into existence as and when needed?

Re: Hammerspoon

#139
post #3

here is my entire config hs.hotkey.bind({"ctrl"}, "D", function() hs.grid.show() end) i've tried all of the other fancy window managers and for me nothing has ever beat the ease of use of just (1) ctrl-d to see the grid, (2) type the letter where you want the top left corner of your window to be, (3) type the letter where you want the bottom right corner to be window resized

This is amazing. Thanks for sharing. Did you ever look into capturing the states of where all the windows are once you are done with resizing them? So as to restore them later back into position if they ever get out of alignment ? Thinking of the usecase where every task or a project deserves a certain arrangement of windows and it would be good to summon them into existence as and when needed?

Im sure that’s possible but my own working style is too chaotic for saving workspaces like that haha
Post reply on HN