Live data from Hacker News

Hammerspoon

github.com

41–50 of 154 posts

Re: Hammerspoon

#43

I use it to enable/disable the wifi when I disconnec/connect the macbook to a specific usb hub with ethernet connection: local usbWatcher = hs.usb.watcher.new(function(device) if device.productName == "EMEET SmartCam C960" then if device.eventType == "added" then hs.execute("networksetup -setairportpower en0 off") hs.notify.new({title="Wi-Fi", informativeText="Disabled (USB device connected)"}):send() elseif device.e…

That should not be required if the Ethernet adapter has a higher priority. That being said, you might different reason.

https://support.apple.com/en-ca/guide/mac-help/mchlp2711/mac

Re: Hammerspoon

#44
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.

You can plug it to your favorite WM (I'm currently using Yabai) and do tons of other interesting things. Because it's all written in Fennel, one can develop things in a tight feedback loop with a connected REPL - e.g., I can ask Claude to inspect things in the running Slack app or Firefox and make interesting automations - all without ever leaving my editor.

Re: Hammerspoon

#46
post #19

I fake a tiling window manager on Mac with Hammerspoon, resizing to fit in specific corners/sizes: -- resize based on ratios function ratioResize(xr, yr, wr, hr) return function () local win = hs.window.focusedWindow() win:moveToUnit({x=xr,y=yr,w=wr,h=hr}) end end -- 4 corners, different sizes hs.hotkey.bind({"cmd", "ctrl"}, "w", ratioResize(0, 0, 2/5, 2/3)) hs.hotkey.bind({"cmd", "ctrl"}, "e", ratioResize(2/5, 0, 3/…

I like the miro windows manager plugin: https://github.com/miromannino/miro-windows-manager

It's nice to be able to iterate through the halves/thirds configurations for different cases.

Re: Hammerspoon

#47

I always confuse "hammerspoon" and "rowhammer"

So, the trivia behind the name is interesting. It all starts with a project called "Mjolnir" (Thor's Hammer). The original idea was for a lightweight automation engine with pluggable architecture. Someone wished to have "batteries included" version, the author said they're not interested in that direction, so the fork was born. What's meant to be a hard-fork, so really not a fork, but rather a "spoon", hence the name.

Re: Hammerspoon

#49
post #29
post #19

I fake a tiling window manager on Mac with Hammerspoon, resizing to fit in specific corners/sizes: -- resize based on ratios function ratioResize(xr, yr, wr, hr) return function () local win = hs.window.focusedWindow() win:moveToUnit({x=xr,y=yr,w=wr,h=hr}) end end -- 4 corners, different sizes hs.hotkey.bind({"cmd", "ctrl"}, "w", ratioResize(0, 0, 2/5, 2/3)) hs.hotkey.bind({"cmd", "ctrl"}, "e", ratioResize(2/5, 0, 3/…

I highly recommend Aerospace[1], went through a few approaches, I cared about not completely compromising security either, it works really well if you come from something like i3 1. https://github.com/nikitabobko/AeroSpace

Seconding this. I find MacOS unusable without it. I'll ask here because websearch is failing me: is there a way to fix the focus stealing that happens when you have multiple windows of an application on different displays? Specifically, say workspace 1 and 2 are on monitor Left, while 3 and 4 are on Right. Application A has a window on workspace 1, B has one window on 2 and another on 3, and C has a window on 4. Workspace 1 is active on display Left, workspace 4 is active on Right. If I switch to workspace 3 the following happens:

- the switch goes through, Left displays workspace 1, right displays 3 (desired state)

- Application B is focused, presumably because its window on 3 becomes active (also desired)

- Display Left switches to display workspace 2, presumably because it contains a window belonging to the newly focused application B? (I don't want this)

- the window of application B on workspace 2 steals focus from the one on workspace 3 (???)

Post reply on HN