7 ms·
Hammerspoon
- golem14 8mo agoHas anyone worked on making a config replicating aerospace? Hammerspoon seems like a superset and it’s probably better to just have one, instead of two tools warring about who gets the keypresses?
- hirvi74 8mo agoWhat features are you trying to replicate from Aerospace?
- golem14 8mo agoWell, a tiling window and workspace manager. But as I am typing this, I’m realizing they hammerspoon can probably do some of the window placement, but maybe not handling workspaces and global state. I was hoping I could be lazy and ask, and a not-lazy person could give a ready made answer :)
- hirvi74 8mo agoIf workspace management is an another term for managing desktop/spaces, then you are going to be hard pressed to find anything that is not a brittle hack. I am writing a window manager bundled with other knick-knacks for myself. I have a "solution" for moving windows between spaces, but in the most vile way possible. The only way I have managed to move windows between spaces is by, and this is no joke, recording the mouse position, moving the mouse to an app's titlebar, automating the 'click and hold' on the window's titlebar, then having the keybindings for "Switch to Next/Previous Space" fire off, and then moving the mouse back to the original position. Because of the animations, all of junk requires carefully timed, short sleeps, which are also not likely consistent across various hardware/OS versions (can't test it myself). Also, I have no idea what happens if my solution is tried on apps with pop-up windows, 'headless' apps (no title bar), electron apps, etc.. Apple's support for spaces is notoriously atrocious. There is no clean way to move windows from one space to another or to create/delete spaces. Though there was a built in way in OSX Snow Leopard, IIRC. Why it was removed? I have no idea. Aerospace creates its own virtual desktops/spaces instead of trying to fight against the OS. I have never used Aerospace, so I cannot comment on its efficacy. But that is probably the cleanest solution we currently have available.
- tcoff91 8mo agoAerospace works really well.
- golem14 8mo agoSadly, I think you’re right. Aerospace is pretty cool, i recommend it, but I have not really worked out how full screen interacts with spaces. It’s a mess with and without aerospace.
- tcoff91 8mo agoI just never run anything fullscreen other than if I’m watching a video.
- r5Khe 8mo agoIt can definitely handle virtual workspaces and global state (if I'm understanding what you mean). I have an Aerospace-like implementation here: https://github.com/mybuddymichael/Helm.spoon https://github.com/mybuddymichael/Helm.spoon It has several features from Aerospace, but Hammerspoon's window management performance is not nearly as good as Aerospace's (not surprising!). Overall, I've found it easier to just fork Aerospace and add various extra features to it, so that's what I'm doing now.
- john-tells-all 8mo agoI'd love to have a global "toggle Teams mute" button.
- hirvi74 8mo agoWhat do you mean? Like muting the entire application so no sound comes from Teams or muting yourself while on a call? For the latter, I thought 'Option + Space' worked (or used to)?
- reddit_clone 8mo agoCmd+Shift+m mutes/un-mutes your Mic when focus is on teams window. I think GP is asking about a global (from any application) mute/unmute teams Mic. I have wished for one for ever.
- hirvi74 8mo agoHmm, I don't have teams installed on my Mac, so I cannot be of much help, but I do have a potential solution for you. Is completely muting your mic sufficient? If so, I have an Applescript solution that seems to work if you want it. I tested it in VoiceMemos and it worked even if I was in a different app in a different space. You can bind the script to a global hotkey very easily via many different apps like Alfred, Karabiner, etc.. AppleScript: https://pastebin.com/xHE1uQym https://pastebin.com/xHE1uQym
- roxolotl 8mo ago``` 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 https://www.hammerspoon.org/Spoons/MicMute.html
- pjm331 8mo agohere 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
- stackghost 8mo agoNot that I insert EOFs very often, but does that conflict with CTRL+D in the terminal?
- xyzzy_plugh 8mo agoI use EOF all the time to end terminal sessions.
- commandertso 8mo agoGreat handle, btw.
- pjm331 8mo agoyeah the CTRL+D definitely gives me problems from time to time but thus far i have been too lazy to fix it
- theshrike79 8mo agoMake caps lock a hyperkey (shift+ctrl+option+cmd) and use that for non-overlapping shortcuts
- 1-more 8mo agomake 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.
- jjmiv 8mo agois 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
- al_borland 8mo agoMy guess is someone just found it. When I was moving to macOS for my work laptop, I was looking for something to replace AutoHotKey. It took me a long time and a lot of digging to actually find HammerSpoon.
- rolymath 8mo agoIs paperwm jittery for everyone?
- kelvie 8mo agoIt's really jittery for me and freezes fairly often on my work macbook. I even have a Sol script to restart hammerspoon. Still wouldn't work without it though (I run Niri at home)
- trjordan 8mo agoI utterly love Hammerspoon. It's fun to combine with qmk [0], which gives you a bunch more options for hotkeys on your keyboard via layers. I've ended up with a layer where half the keyboard is Hammerspoon shortcuts directly to apps (e.g. go to Slack, to Chrome, etc.) and half of it is in-app shortcuts (like putting cmd-number on the home row, for directly addressing chrome tabs). Between this and one of the tiling window manager-adjacent tools (I use Sizeup), I can do all my OS-level navigation directly. "Oh I want to go to Slack and go to this DM" is a few keystrokes away, and not dependent on what else I was doing. [0] https://qmk.fm/ https://qmk.fm/
- henrebotha 8mo agoMy QMK Tmux "layer" is still one of my favourite customisations. Prepends Ctrl-B to everything I type.
- incanus77 8mo agoHammerspoon 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
- piskov 8mo agoKeyboard stuff is better handled with Karabiner elements
- dbalatero 8mo agoKarabiner can _create_ new keys like hyper, but you _bind_ them with Hammerspoon.
- joemi 8mo ago> - 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.)
- michaelteter 8mo agoI have no idea how that person is doing it, but I suspect it could be using osascript. Here's how I do it from my homegrown Go bookmark tool: const fetchTabsScript = ` tell application "Brave Browser" set output to "" repeat with w in windows repeat with t in tabs of w set output to output & (URL of t) & "|||" & (title of t) & "\n" end repeat end repeat return output end tell ` func GetOpenTabs() ([]Tab, error) { cmd := exec.Command("osascript", "-e", fetchTabsScript) output, err := cmd.Output() // ... }
- mwagstaff 8mo agoCan't live without Hammerspoon on Mac. Can't live without AutoHotkey on Windows. Thanks to everyone who contributed to both!
- hirvi74 8mo agoI 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.
- weitzj 8mo agoI love hammerspoon. That's it :D It's lua, so you can get creative with https://fennel-lang.org/ https://fennel-lang.org/
- hmokiguess 8mo agowhat's your favourite spoon?
- zdw 8mo agoI 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 8mo agoI 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 https://github.com/nikitabobko/AeroSpace
- idle_zealot 8mo agoSeconding 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 (???)
- jmcguckin 8mo agoI 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.
- juancn 8mo agoI use it to hide Zoom's screen sharing controls so they don't come back when pressing Esc: -- Hide Zoom's "share" windows so it doesn't come back on ESC keypress local zoomWindow = nil local originalFrame = nil hs.hotkey.bind({"cmd", "ctrl", "alt"}, "H", function() print("> trying to hide zoom") if not zoomWindow then print("> looking for window") zoomWindow = hs.window.find("zoom share statusbar window") end if zoomWindow then print("> found window") if originalFrame then print("> restoring") zoomWindow:setFrame(originalFrame) originalFrame = nil zoomWindow = nil else print("> hiding") originalFrame = zoomWindow:frame() local screen = zoomWindow:screen() local frame = zoomWindow:frame() frame.x = screen:frame().w + 99000 frame.y = screen:frame().h + 99000 zoomWindow:setFrame(frame) end else print("> window not found") end end)
- henrebotha 8mo agoOh my god, immediately worth installing just for this
- overflowy 8mo agoI 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 ...
- alexfortin 8mo agoI 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()
- jmarcher 8mo agoThat 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 https://support.apple.com/en-ca/guide/mac-help/mchlp2711/mac
- swiftcoder 8mo agoI always confuse "hammerspoon" and "rowhammer"
- iLemming 8mo agoSo, 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.
- selectnull 8mo agoLove hammerspoon. I use it to map double CMD to swap between the terminal and the browser.
- theshrike79 8mo agoI tried to find a proper window control tool for macOS for a while, tested Rectangle and Magnet and dunno how many. Then I just figured out that I have Hammerspoon, it can control windows -> recreate one exactly how I like it. Been using it for a year now and it's 99% perfect. Some specific applications (coughFirefoxcough) sometimes get into a weird state that doesn't work, but I can live with that. It can also pop all windows to a specific layout with a single shortcut by combining the active wifi + monitor setup to detect if I'm at home, at work, or working at home.
- piskov 8mo agoMoom works like a charm
- regus 8mo agoHow does this compare to AppleScript?
- wetpaws 8mo ago[dead]
- dbalatero 8mo agoInsanely easier to use, way better programming language, a kitchen sink of macOS APIs, and you can still call out to AppleScript when you need it: https://www.hammerspoon.org/docs/hs.osascript.html#applescript https://www.hammerspoon.org/docs/hs.osascript.html#applescri...
- cjbarber 8mo agoSee also: KeyboardMaestro Automator and AppleScript Raycast
- ChrisArchitect 8mo agohttps://www.hammerspoon.org/ https://www.hammerspoon.org/ Some previous discussion: 2021 https://news.ycombinator.com/item?id=29533495 https://news.ycombinator.com/item?id=29533495 2019 https://news.ycombinator.com/item?id=21801178 https://news.ycombinator.com/item?id=21801178
- iLemming 8mo agoShameless plug/proud self-promotion - https://github.com/agzam/spacehammer 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.
- jedbrooke 8mo ago> "alt+cmd m j/k" (media -> vol up/down) if only keyboards came with built in buttons for adjusting the volume… oh wait. Unless of course you are suffering on a touch bar mac, then I completely understand.
- iLemming 8mo agoIt's not about "having" or "not having" keys for specific actions, it's all about freedom and feeling of control. When you take and apply the idea of modality, you quickly realize that you are no longer constrained with the number of combinations you can have or the type of keyboard you're using. Everything can be controlled by (mostly) using home-row keys - h/j/k/l - without having to memorize weird combinations of modifiers and keys - "was it Ctrl+Alt+Cmd F, or just Ctrl+Cmd F?" alt+cmd (was a typo, I meant to say alt+space), which is configurable - I myself prefer using cmd+space. That opens the "main" modal, from where you can configure "conditional branching" - e.g. "m" - for "media", or "a" - for "apps", so with "alt+space m j/k" you can do volume up/down, while pressing h/l could be "previous/next song". Then, "alt+spc a b" activates the browser, and "alt+spc a t" - could be bind to activate "terminal", etc. It only looks like you have to press more keys to achieve anything, in practice - you quickly develop muscle memory. Then switching between the apps, moving windows around and resizing them, controlling playback, etc. - it all gains incredible productivity without affecting the focus point. You don't need to keep moving your hand for the mouse, you don't need to memorize and deal with myriad of modifier-driven key combinations - you control precisely what you need, without ever having to contort your fingers to hold modifiers, without ever thinking "what should I bind this action to, all memoizable keys are already taken, I suppose I'll just bind it to this impossible combo with a key that has no semantic meaning for the thing..." With Spacehammer you can create mnemonically-handy actions e.g., "o f" for "Open in Finder", while in another context that may work as "Open in Firefox".
- gedy 8mo agoIf you are on macOS but miss Paperwm or niri, etc this is a good compromise thanks to Hammerspoon: https://github.com/mogenson/PaperWM.spoon https://github.com/mogenson/PaperWM.spoon
- ifh-hn 8mo agoIt's this like Mac equivalent to autohotkey on windows?
- msephton 8mo agoKinda, I'd say Hammerspoon can do more.
- scm7k 8mo ago[dead]
- dbalatero 8mo agoI have an unreleased pile of tutorial projects with Hammerspoon. I think not all chapters are finished, so I need to clean up and finish it at some point soon: https://learnhammerspoon.com https://learnhammerspoon.com
- kcrwfrd_ 8mo agoI despair at not being able to easily send a window to another space with a keyboard shortcut on macOS. Yabai supports this perfectly (especially combined with instant, animation-free space switching) but it requires disabling system integrity protection--which is a non-starter on a work computer. Aerospace solves it with their own spaces implementation. I was able to put together a hammerspoon script that does the job decently enough for my purposes: https://gist.github.com/kcrwfrd/6f3dcaec0e08e0e77b2884588a3456ae https://gist.github.com/kcrwfrd/6f3dcaec0e08e0e77b2884588a34...
- tcoff91 8mo agoAerospace is the least bad option
- dbalatero 8mo agoSome stuff I've made in Hammerspoon you can use: - Vim mode everywhere in macOS: https://github.com/dbalatero/VimMode.spoon https://github.com/dbalatero/VimMode.spoon - Modifier keys + click/drag to resize or move windows: https://github.com/dbalatero/SkyRocket.spoon https://github.com/dbalatero/SkyRocket.spoon - Show an overlay helper of all your keybinds when you hold modifier keys down: https://github.com/dbalatero/HyperKey.spoon https://github.com/dbalatero/HyperKey.spoon And my huge pile of random scripts/configs: https://github.com/dbalatero/nixpkgs/tree/main/home/modules/gui/macos/hammerspoon/config https://github.com/dbalatero/nixpkgs/tree/main/home/modules/...
- tcoff91 8mo agoI like kindaVim for vim mode everywhere in macOS
- cmsj 8mo agoHammerspoon 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
- kbd 8mo agoHmm I already avoid Lua by writing in Fennel, I’ll probably avoid the JS by writing… what Lisp compiles to JS, ClojureScript?
- iLemming 8mo agoCljs setup for this case probably would require a bit of scaffolding. While using https://github.com/squint-cljs/squint 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.
- kbd 8mo agoThat's cool, I hadn't heard of Squint, thanks! Looks lightweight. Another compile-to-js option that seems good is Gleam.
- zimpenfish 8mo ago> a v2 atm, which switches from Lua to JavaScript :D Presumably that'll be released in [checks calendar] 18 days?
- themadsens 8mo agoMaybe not: https://www.reddit.com/r/hammerspoon/comments/1puln7j/110_released_and_a_discussion_about_the_future/ https://www.reddit.com/r/hammerspoon/comments/1puln7j/110_re... https://github.com/cmsj/Hammerspoon2 https://github.com/cmsj/Hammerspoon2
- saagarjha 8mo agoHammerspoon is one of the first apps I install on my Mac. Not having it makes it more or less broken to me.
- rco8786 8mo agoLove Hammerspoon
- nxobject 8mo agoThank you so much for doing what Apple's neglected to do for many years! The way they let AppleScript/JXA rot was criminal.
- fudged71 8mo agoI recently set up Hammerspoon to surveil my own computer usage actions (active tab/window, typing state, scrolling) to have a next-action predictor. It shows the predicted next action at the top of the screen but I was thinking of using it to improve voice command accuracy.
- msephton 8mo agoI use it to: - implement a keyboard based window manager - arrange/quit/launch some things based on whether my MBP is docked or not - resize and reposition certain windows that don't remember their own size and position - certain other hotkeys - probably stuff I forgot and rely on! I'll be sad when it moves from Lua to JavaScript, but I guess that's better than moving to Tcl.
- tcoff91 8mo agoI really like the Label feature. I use it to put labels on the screen in my different aerospace workspaces so I can keep track of which project I’m working on. With agents working in parallel this is really useful.
- smasher164 8mo agoOne of the reasons I left macos was that automation via Automator and Applescript was inconsistent and unsupported in many contexts. Well that and the locking down of app distribution and sandboxing. However, the positive reception to Hammerspoon is making me consider trying it again.
- abhikul0 8mo agoComing from windows to macos, I(i think i used perplexity :P) created a spoon for switching between open windows with 4 finger swipe[0]. Swiping left/right switches between windows, swiping down minimizes all visible windows, swiping up restores them(one by one). Created this repo to backup my config with an llm documenting it. It uses a swipe gesture detection spoon I found after searching for something similar[1]. [0] https://github.com/abhikul0/hammerspoonConfig https://github.com/abhikul0/hammerspoonConfig [1] https://github.com/mogenson/Swipe.spoon https://github.com/mogenson/Swipe.spoon
- xendipity 8mo agoExcited to see this here! Only yesterday I used it to create an interactive native-like notification my coding agents use to ping me when they push a PR. I had tried a few different libraries over the past month but only hs had the ability to render custom panes over maximized windows. Will be using it for more automation tools moving forward.
- krick 8mo agoIs there something for Xfce?
- robsalasco 8mo agoI use https://github.com/miromannino/miro-windows-manager https://github.com/miromannino/miro-windows-manager for ages!
- ljosifov 8mo agoGlad to see other people using it. Saved my life, was going crazy click-clicking to nab the right window. Now Cmd-1..9 brings to focus a window of my chosen application. (Chrome) In case it helps someone else, myself and Codex iterating over time https://github.com/ljubomirj/dotfiles/blob/main/.hammerspoon/init.lua https://github.com/ljubomirj/dotfiles/blob/main/.hammerspoon.... Cmd-1..9 switches over focuses to a particular window, Cmd-0 presents an (ugly; but suffices) dialog box to select the window with arrows (of the App of interest - Chrome for me atm) to switch to. But more important - to see what window what Window name is recalled by the particular Cmd-1..9 shortcut. Option-arrows shuffle window-to-key ordering. I right-click-Name Window my windows. Think back now - on restart they may even be preserved?? Don't recall re/naming them manually recently. (possible I've forgotten though)
- radku 8mo agoHammerspoon helped me have a F12 shortcut for Ghostty (the only feature I missed from guake on mac)! I love it
- hibbelig 8mo agoI 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.
- Alifatisk 8mo agoThe title has space for more description, maybe add "macOS desktop automation with Lua"?
- reactordev 8mo agoThis is more powerful than Mac’s own Automator tool, Lua is an interesting choice. Mac Automator used to only support AppleScript but now it supports JavaScriptCore from WebKit so you can run JavaScript with Mac Automator. This is what I do. I’ll have a hell of a time rewriting everything into Lua when I have soooo many node packages I leverage.
- wlonkly 8mo agoGood news for you -- Hammerspoon v2 is going to use Javascript instead of Lua.
- tomduncalf 8mo agoAs chance would have it, I just tried this for the first time as I wanted to bind a keyboard shortcut to an option from a menu bar app which doesn’t support keybinding. ChatGPT wrote a script which uses AppleScript to do it. Really anwesome, and excited to find more cool things to do with it!
- homakov 8mo agoI vibecoded a local whisper replacement (free version of superwhisper/mac whisper basically) with claude and hammerspoon: https://github.com/xlnfinance/xln/blob/main/ai/install-voice-paste.sh https://github.com/xlnfinance/xln/blob/main/ai/install-voice... cmd+, and it transcribes on release.
- socalgal2 8mo agoThis 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?
- wlonkly 8mo agoAppleScript predates Javascript by two years, but by even more than that in terms of usability. It was definitely designed for "non-programmers", the people buying Macs in the System 7 days. But modern MacOS is automatable using Javascript in Script Editor, so they're catching up.