notes

seedling

Plebeian Programming with Keyboard Maestro

How to write macros without touching the terminal

I'm not just talking about vanilla hotkeys like Cmd + S or Cmd + Q that save a file or quit an application.

Any hotkey that triggers a single action like copying text to your clipboard is equally capable of performing multiple actions in quick succession; opening a specific set of files, launching multiple applications, pasting a pre-written string of text, playing a particular song in Spotify, starting a countdown timer, and arranging your desktop windows just the way you want them.

Anything you can manually do on your machine with your two hands can be wrapped up into a programmatic sequence and performed by the machine without you touching it.

These sequences are called macros and you don't need to know how to programme to create them. Programmatic plebs (like me) can build powerful automations without needing to write a bunch of BASH commands in the Terminal.

You do need a macro application with a user-friendly interface though. IMHO is one of the best designed and easiest to use options. It's a Mac app (sorry Windows users) that allows you to visually compose small sequences of actions that you can easily trigger at any time.

The Keyboard Maestro main window

There are alternative (Windows-compatible) macro applications that can do similar things: , , and . However, I haven't personally used these and will only be singing the praises of Keyboard Maestro from here on out.

This isn't going to be a beginner's guide to using Keyboard Maestro (hereafter known as KM), so I suggest you take a look at this and this TutsPlus if that's what you need. If you want to get extra intense about learning KM, David Sparks has created a very that covers everything under the macro sun. There is also an you can reference, but it throws you into the technical weeds a lot.

Rather than giving you I'm going to jump into the ways I use KM and the particular macros I find useful on a daily basis. By seeing some very tangible examples of what KM can do, perhaps you'll be intruiged and get ideas for what you might want to automate.

Workflow Macros

One of the most basic groups of macros I rely on are what I call workflow macros.

Triggers can of course be hotkeys, but you can also use certain times of day, trackpad gestures, or typed strings of text as triggers. You can also use computational events as triggers: your machine waking up, a certain application launching, or connecting to a certain wifi network.

These actions can do anything you can do through manual interaction on your machine – type text, copy/paste from the clipboard, open menus, click buttons, launch applications, navigate to websites. It's a programmatic version of you that you write instructions for ahead of time.

Want to share?