Live data from Hacker News

Hammerspoon

github.com

111–120 of 154 posts

Re: Hammerspoon

#111

Earlier quoted context omitted.

It's not trivial, but roughly: use AppleScript/osascript to get the URLs, but mostly pass them to a ~50 line Bash script which: - Brings in the date path components for the dumped-to folder - Makes a hash of the URL for an Obsidian doc (each tab gets their own doc) - Uses Chrome command line (--headless --disable-gpu --dump-dom) to save a snapshot of the page contents - Uses it again with --screenshot to make a thumb…

> - Uses Chrome command line (--headless --disable-gpu --dump-dom) to save a snapshot of the page contents > - Uses it again with --screenshot to make a thumbnail You could combine both of those into "run Archivebox somewhere and pass the URLs into that" (which is what I do for "URLs I save to Instapaper" - they go to my Linkhut, Pinboard, my Archivebox, and once I've fixed my code, to archive.org as well.)

Nice, thanks for the vote on it. Been meaning to look into a personal archiving solution, and now the pendulum is swinging back in the direction of homelab for me so it's on the list.

Re: Hammerspoon

#112

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…

Could you share your config?

It's fairly sprawling right now — a small init.lua that sources four other files, most over 100 LOC. What are you most interested in?

Re: Hammerspoon

#113
post #59

Earlier quoted context omitted.

> - Dumping all open Safari tabs to an Obsidian doc I'd love to do this too. Would you mind sharing how you do it? Or is it trivially easy and not worth explaining? (I haven't looked too deeply into HS yet.)

It's not trivial, but roughly: use AppleScript/osascript to get the URLs, but mostly pass them to a ~50 line Bash script which: - Brings in the date path components for the dumped-to folder - Makes a hash of the URL for an Obsidian doc (each tab gets their own doc) - Uses Chrome command line (--headless --disable-gpu --dump-dom) to save a snapshot of the page contents - Uses it again with --screenshot to make a thumb…

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?

Re: Hammerspoon

#114

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…

Impressive ‘spooning!

I use it for one thing only, as a window manager, and for that purpose it has made MacOS eminently more usable for me.

Re: Hammerspoon

#115

Earlier quoted context omitted.

It's not trivial, but roughly: use AppleScript/osascript to get the URLs, but mostly pass them to a ~50 line Bash script which: - Brings in the date path components for the dumped-to folder - Makes a hash of the URL for an Obsidian doc (each tab gets their own doc) - Uses Chrome command line (--headless --disable-gpu --dump-dom) to save a snapshot of the page contents - Uses it again with --screenshot to make a thumb…

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, intricate client work specs or outlines, and the beginnings of a personal wiki. The keybinds are great, everything is in one big folder for now, and the fuzzy search makes it fast. For sync, I just have my vault in a folder that is part of my overall Syncthing, so all my computers can access it. On mobile (iPhone moving to Android, and iPad) it's just read-only for now; not using their sync or doing any writing into the system from mobile.

Somewhat relatedly, I just got Standard Notes going on all systems (Mac/Linux/iPhone/Android/iPad) which is good for reliable capture at all places for me right now. I'm not paying, so I don't have (Markdown or other) formatting like in Apple Notes yet.

Re: Hammerspoon

#116
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!

Re: Hammerspoon

#117
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... :)

What’s so hard to figure out about Lua if you already know JS?

Lua is a better JS.

/ducks

Re: Hammerspoon

#118
Hammerspoon helped me have a F12 shortcut for Ghostty (the only feature I missed from guake on mac)! I love it

Re: Hammerspoon

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

Re: Hammerspoon

#120
I used to be a fan of tiling window managers, but I found out that I tend to use fairly visually heavy apps on a Mac. By this I mean apps that need quite a bit of screen real estate to show everything that needs to be shown:

The mail program has a folder tree on the left, the list of messages in the center, and the current message on the right. The IDE has all these tool windows that need showing, in addition to the actual editor. Websites also like it if the window size is a bit more.

Back when I was using Emacs and xterm, mainly, it was nice to show Emacs in the left half and then two xterms on the right.

So instead of tiling, I've come to realize that I only need a couple of window positions and sizes: Mail program and IDE are full screen. The browser occupies 70% width and height, in the top right corner, and the terminal is in the bottom left corner, 200 columns by 44 rows or so. (Lazygit works better if the terminal is a bit larger.) The chat program is full height, 60% width, left edge.

In this way, while the IDE is building or running tests, I can summon the web browser and still see at the bottom and on the left what is the progress of build or test. Also, when I use the software through the browser, I can see a couple of lines of log messages, which is enough to tell me whether to switch.

So I'm now happy with hotkeys in Hammerspoon that reposition and resize the current window to one of these presets, and to jump to a specific app with a keypress. I use a modal for this.

I dig the idea of having multi-level modals, somehow this idea never occurred to me.

Post reply on HN