OS X Automation Swiss Army Knife

I spend an unhealthy amount of time tweaking my Mac. I think if I was born in the 50s I would totally be that guy who spends all his time tinkering with his car.

In my never-ending quest to setup my Mac in the best way possible I stumbled upon a number of tools that I can use to automate OS X. I’ve mentioned Slate before. Today I want to talk about Hammerspoon.

Hammerspoon, like Slate lets you assign hot keys to control window size and position. However, to say Hammerspoon is a window manager really doesn’t do it justice.

Hammerspoon is an automation tool for OS X. The tool exposes a bunch of pieces of system functionality in a way that is scriptable.

With Hammerspoon you can write scripts that interact with OS X APIs. You can do the aforementioned window management. You can also control applications, the clipboard, audio devices, retrieve information about the battery, access the filesystem and a whole bunch more.

Here are some of the practical things you can do with Hammerspoon.

  1. Control your window sizes and positions
  2. Move windows between Spaces
  3. Throw windows to different monitors
  4. Configure windows differently when you unplug your monitors
  5. Auto-reload it’s configuration whenever the config file changes.
  6. Cycle your browser between multiple user agent strings
  7. Lock your computer using a hotkey combination
  8. Prevent your Mac from going to sleep
  9. Launch specific applications when you come home.
  10. Launch your scanner application whenever you plug in your scanner
  11. Defeat paste blocking
  12. Send a text message to your spouse whenever your arrive home
  13. Replace your clipboard with a clipboard manager
  14. Implement a Pomodoro timer
  15. Control iTunes

I’ve used to to replace Keyboard Maestro. I’m likely going to replace Slate when I have the time to recreate my window management functions.

You can see my hammerspoon config file in my github repo.

Have you used Hammerspoon or do you have a favorite Mac automation tool? Let me know in the comments.

Leave a Comment