iPad control of Keyboard Maestro using Sidecar

I am very excited to report that I have come up with a way to activate macros in Keyboard Maestro using a Mac with an iPad attached using Sidecar. And WOW is it cool.

The reason I did this was because a few days ago I saw some posts about the support Keyboard Maestro gives for a product called "Stream Deck." And I was trying to debate whether to spend over $100 to get one. It's pretty cool because its buttons are essentially little monitors which let you change the keycaps electronically, and KM supports that now.

But then I was thinking "I'm lazy, and I'm cheap. Isn't there a way to connect an iPad to my Mac to allow me to press buttons on my iPad's screen to get basically the same result?" And after a couple of days of work, I've succeeded. Mostly. The main downside is that when you press the button you have to use the Apple Pencil. That's definitely a disadvantage, but it's still very cool to see it in operation.

This is one of those things that's better to see in action than for me to upload the macro. So here's a short video of it in action:

And here's a short document from Apple explaining how Sidecar works:

It might not be useful for handicapped people because it requires using the Apple Pencil. A couple of years ago you couldn't use the Pencil for this purpose. I'm hoping that Apple will allow you to use your fingers in the future. That would really help. We could petition Apple to support fingers in Sidecar. It makes no sense why Apple doesn't allow touch but allows Pencil input in Sidecar.

I could upload my code, but at this point I'm not 100% sure if any of my code requires macOS Monterey, which won't be coming out for a few more weeks.

Sidecar does support wireless transmission between the iPad and the Mac, but for some reason I can't figure out I can't get that working right now. It says something like my "signal is too weak." So in this video you can see a USB cable running from my tablet to my Mac.

P.S. In my video demo I should have pressed the button "Highlight Location." Maybe I'll come up with some new examples and post a new video.

1 Like

Hi @Sleepy,
Thanks for sharing.

Products like Touch Portal do better jobs for this purpose. Besides the native actions, they can also execute shell scripts, though which we can trigger any KM macros by UUID.

There are quite a few posts about Touch Portal already. See:
https://forum.keyboardmaestro.com/search?q=touch%20portal%20category:9

I had never seen those posts before. Thanks for pointing them out to me. It's a good app. Is it free? EDIT: it's not very expensive, but not free.

It seems that you think my solution can't execute shell scripts. That's not correct. My solution executes any macro that you want and naturally they can include shell scripts.

My solution has a cool trick that you can't tell by watching the video. It fetches the names of all your macros from a specific folder, then puts the names on the buttons, then triggers the macro of that name when you click on its button. That sounds like a lot less work than manually entering UUIDs.

EDIT: Touch Portal's main benefit is that it has built-in buttons that can connect with specific apps or online services so that the user can automate some of those services with buttons. This is exactly the kind of thing that KM excels at. Touch Portal also supports icons on the buttons, which I currently don't support because I got my code working only an hour ago, but I certainly could add icon support if I wanted to. I would need to brush up on my HTML so that I can pass icons to buttons.

No, I did not think so. Your solution is just like executing KM macros on Mac, and Sidecar gives the touch screen function. What I was trying to say is that Touch Portal can trigger any KM macros, not implying that your solution cannot do that.
It is paid, but comparing with Stream Deck, it is just a fraction of price. It has iOS and android app, therefore, it is not limited to iPad devices.

Thanks @Sleepy for all the Monterey posts.

If you want to use your fingers, there’s an app called Duet that supports touch.

That's another great tip for me to consider. That's an inexpensive program, but not free. And they haven't updated it in about a year so their privacy label on the App Store is non-existent. As far as I can see, KM is the only software that I have on my Mac that doesn't come from Apple or the Apple App Store. It takes a lot to get me to trust a vendor that doesn't sell on the App Store. If I recall correctly, KM used to be sold on the App Store and I was buying it way back then too.

And regardless of how good those products are, I simply enjoy writing code with KM. I can also trust my own code, and since my source code will be available on this website - if people want it - then others can trust it too. You can't see the source code in any commercial product. Contributing new software is one way I like to pay Peter back for the great software he builds for us. It's also more fun writing your own apps than buying them from others. I'm writing my software for me and my friends, and if no one else wants it, that's no problem.

1 Like

Their subscription app, called Duet Air is updated constantly. Also their Mac app is updated regularly.

How did you make that "button page"? is that a native KM feature?

To quote Sleepy (who hasn't been around for a while, unfortunately):

My solution has a cool trick that you can't tell by watching the video. It fetches the names of all your macros from a specific folder, then puts the names on the buttons, then triggers the macro of that name when you click on its button.