Discussion
Search code, repositories, users, issues, pull requests...
john-tells-all: I'd love to have a global "toggle Teams mute" button.
jjmiv: is there a particular reason this was shared?otherwise I'm slowly working on a Spoon that figures out if there is an active meeting in Zoom, Teams, Huddle, Google Meet and will allow for muting, video enable/disable and screen sharing etc
pjm331: 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 bewindow resized
stackghost: Not that I insert EOFs very often, but does that conflict with CTRL+D in the terminal?
incanus77: 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 Sketchybar - Quitting all Dock apps except Finder - Screen lock - System sleep - Opening front Finder folder in VS Code - Opening front Safari URL on Archive.today - Showing front Safari window tab count - Showing front app bundle ID - Posting notification about current Music track - Controlling my Logi Litra light (various color temps/brightnesses) - Starting/stopping a client work timer - Tying it to AeroSpace for: - Pushing a window to another monitor - Performing a two-up window layout - Swapping those two windows - Closing all other workspace windows - Gathering all windows to first workspace - Ensuring some background apps stay running if they crash - Prompting to unmount disk images if trashed - Binding into Skim to jump to specific sections of spec PDFs using terse Markdown URLs
hirvi74: I have fond memories of this app. However, after many years, I have moved on. I am in the process of writing my own replacement for some of the various use cases that Hammerspoon once provided me. Though, Hammerspoon will always be a source of great inspiration.
mwagstaff: Can't live without Hammerspoon on Mac.Can't live without AutoHotkey on Windows.Thanks to everyone who contributed to both!
elAhmo: This is amazing! I have a slightly more elaborate setup that allows me to resize from one or another side, similar to what Apple added recently but with more flexibility, but this is super interesting, thanks for sharing!
jmcguckin: I use it to give me focus-follows-mouse and to have a large circle surrounding the mouse when i move it, to aid finding it.
xyzzy_plugh: I use EOF all the time to end terminal sessions.
commandertso: Great handle, btw.
overflowy: I use this to remap app keys: local appHotkeys = {} local function remapAppHotkey(appName, fromMods, fromKey, toMods, toKey, delay) if not appHotkeys[appName] then appHotkeys[appName] = {} end local hotkey = hs.hotkey.new(fromMods, fromKey, function() hs.eventtap.keyStroke(toMods, toKey, delay or 0) end) table.insert(appHotkeys[appName], hotkey) end local appWatcher = hs.application.watcher.new(function(appName, eventType) local hotkeys = appHotkeys[appName] if not hotkeys then return end for _, hotkey in ipairs(hotkeys) do if eventType == hs.application.watcher.activated then hotkey:enable() elseif eventType == hs.application.watcher.deactivated then hotkey:disable() end end end) appWatcher:start() -- Remap app hotkeys remapAppHotkey("Finder", { "cmd" }, "q", { "cmd" }, "w", 0.5) ... etc ...
hrmtst93837: Neat until you need to sync configs or keep multiple machines in harmony, at which point dotfile headaches stack up with Hammerspoon and Lua. Adding complex logic like window rules, app-specific behavior, or handling monitor changes strips away some of that hotkey simplicity and leads to endless tweaking. Still, for avoiding the mouse, it's one of the few flexible options left on macOS that doesn't feel ancient. Tradeoffs everywhere but nowhere else really compares in control.
roxolotl: ```hs.loadSpoon("MicMute")binding = { toggle = { {"ctrl", "alt"}, "m" } }spoon.MicMute:bindHotkeys(binding)```You'll have to add the MicMute spoon which just mean downloading the zip here, unzipping, and opening the .spoon. https://www.hammerspoon.org/Spoons/MicMute.html
swiftcoder: I always confuse "hammerspoon" and "rowhammer"
alexfortin: 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.eventType == "removed" then hs.execute("networksetup -setairportpower en0 on") hs.notify.new({title="Wi-Fi", informativeText="Re-enabled (USB device removed)"}):send() end end end) usbWatcher:start()
zdw: 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/5, 2/3)) hs.hotkey.bind({"cmd", "ctrl"}, "s", ratioResize(0, 2/3, 2/5, 1/3)) hs.hotkey.bind({"cmd", "ctrl"}, "d", ratioResize(2/5, 2/3, 3/5, 1/3)) And to throw windows to other monitors: -- send to next screen hs.hotkey.bind({"cmd", "ctrl"}, ";", function() local win = hs.window.focusedWindow() local screen = win:screen() local next_screen = screen:next() win:moveToScreen(next_screen) end)
comboy: 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 i31. https://github.com/nikitabobko/AeroSpace
theshrike79: [delayed]
theshrike79: Make caps lock a hyperkey (shift+ctrl+option+cmd) and use that for non-overlapping shortcuts
jeberle: [delayed]