It’s easy to use and has great docs. Lua is fun to write. HS is a really nice project.
Hammerspoon – Lua-based powerful tool automation of macOS
11–20 of 84 posts
Re: Hammerspoon – Lua-based powerful tool automation of macOS
#12Really nice at first sight. I'm getting melancholic vibes of AutoHotKey reading the docs, which was arguably my first entry into professional programming. Knowing nothing about coding, I built a service desk automation back then — with (network file-) shared hotkeys and a real GUI, all in one single file... good times. Anyway, ever since switching to MacOS more than a decade ago, I've always been searching for an AHK…
you can set those in the keyboard settings in system preferences. i have used the text replacement tab a lot in the past. i used it to auto-insert smileys and text snippets on various platforms. i haven't used shortcuts much though. you always end up with complicated shortcuts so you don't conflict with your apps.
Re: Hammerspoon – Lua-based powerful tool automation of macOS
#13Here are the top ways I'm using it right now:
1) Hide/show apps similar to how iTerm lets you bind a hotkey to hide/show a terminal. I've got ctrl+space set to Vimcal, alt+space set to midnight.app (a time tracker I'm building), and ctrl+alt+space set to Things.
2) Start/stop playing my work playlist of lofi hiphop. I got tired of the friction around opening Spotify, going into my work playlist, hitting play, waiting several moments for the playlist to load, etc, so I downloaded a bunch of mp3s from YouTube and put them in ~/Music/work/. Now my work music is a single keyboard shortcut (semicolon+m) and a few miliseconds away.
3) Set up screen recording. There are a few things that need to happen before I start a screen recording (opening CamHead.app, setting my screen resolution, and showing the dock at a certain height so I can later crop the video to 16:9) and I have it all bound to a single hotkey (semicolon+r). I've got another hotkey set up to unset it (semicolon+e).
4) You may have noticed I'm using keyboard shortcuts with semicolon as a modifier key. That's done with Hammerspoon too! I've got an extra layer of hotkeys available to me to set up whatever else I can think of in the future. The code I wrote to use semicolon like this sometimes breaks if I try to type too many actual semicolons in a row but I usually rely on JS Beautify to add those for me.
Re: Hammerspoon – Lua-based powerful tool automation of macOS
#14Earlier quoted context omitted.
Have you tried AppleScript scripting? You can glue applications together and even use JavaScript if you’re not a fan of AppleScript
Did some, but the syntax wasn't my cup of tea. The _really_ great feature of AHK to me was having the triggers and the actions all in one place though, which is something I couldn't really replicate with AppleScript that only has the actions, with the triggers in Automator. So with that runtime you could easily just write whatever would happen if you press which key combo (or do cronjob-like things managed by the run…
I also really like Hammerspoon. The desktop automation scene on macOS is strong.
Re: Hammerspoon – Lua-based powerful tool automation of macOS
#15Re: Hammerspoon – Lua-based powerful tool automation of macOS
#16Re: Hammerspoon – Lua-based powerful tool automation of macOS
#17Re: Hammerspoon – Lua-based powerful tool automation of macOS
#18Re: Hammerspoon – Lua-based powerful tool automation of macOS
#19- Mute my computer when I put it to sleep or when I change wifi networks
- Hyper key
- Mail.app menubar indicator
- Spotify menubar current song
- Shortcut to move mouse cursor to another monitor
- Window switcher that only lists apps in the current workspace
Re: Hammerspoon – Lua-based powerful tool automation of macOS
#20Really nice at first sight. I'm getting melancholic vibes of AutoHotKey reading the docs, which was arguably my first entry into professional programming. Knowing nothing about coding, I built a service desk automation back then — with (network file-) shared hotkeys and a real GUI, all in one single file... good times. Anyway, ever since switching to MacOS more than a decade ago, I've always been searching for an AHK…