Six Colors
Six Colors

by Jason Snell & Dan Moren

This Week's Sponsor

Save 20% on the award-winning Audio Hijack with coupon code 6C20AH!

By Jason Snell

A Stream Deck recording button, with feedback

Last week Audio Hijack 4 arrived, and was I excited about its automation features. I had several people ask me about a simple automation I created, which generates a single button on a Stream Deck that toggles recording on and off and changes its display based on recording status.

I wish it didn’t, but (at least for now) the only way to control the appearance of a Stream Deck button via automation tool involves Keyboard Maestro. So to make this automation work, I have to create a shortcut, and then run that shortcut from within Keyboard Maestro.

First, the shortcut:

This is pretty straightforward. There’s a single line of JavaScript that determines if my session, “Podcast lossless,” is running:

return (app.sessionWithName('Podcast lossless').running)

If the result is false, the session is not running. The shortcut turns it on. Otherwise, the session is running, and the shortcut turns it back off. In either case, the shorcut then uses the new “stop and output” feature of Shortcuts to output that same result. This is what Keyboard Maestro will use to do its thing.

Here’s the Keyboard Maestro macro:

The macro is executed by a Keyboard Maestro action on the Stream Deck, on a button with a particular ID—in my case, its R2C3, but it can be just about anything. All this Macro does is run my Shortcut, which is titled “AH Toggle Lossless”, and save the results—namely, the shortcut’s output, which it’s getting from Audio Hijack—to a variable.

Then based on the contents of that variable, the Keyboard Maestro macro either assigns an icon indicating that recording has been turned on, or that it’s been turned off.

That’s it! You can create much more complicated automations—as I wrote about last week, my Incomparable automation features three separate states that you move through via button press—but simple ones are possible too. And if you don’t care about the button changing color, you can avoid Keyboard Maestro and just run the Shortcut directly via the Shortcuts by Sentinelite Stream Deck plug-in.

If you appreciate articles like this one, support us by becoming a Six Colors subscriber. Subscribers get access to an exclusive podcast, members-only stories, and a special community.

Search Six Colors