SideCar If Statement

Dear All,

I want to build a macro with an if statement based on SideCar is running (iPad Connected) or not.

How can Keyboard Maestro can know if SideCar is running or not?

What condiction should I use?

Best regards,
Joao Coutinho

Hrm. I'm not sure it's possible to definitely know if SideCar is running unless @peternlewis knows some API trick (in which case, I'd like know too).

Here's what I can tell you:

if SideCar is running, then avconferenced will be running = TRUE

However, the opposite is not necessarily true:

if avconferenced is running, then SideCar must be running = FALSE

That's because avconferenced is used for FaceTime, and AirPlay, and I believe that once it launches, it stays running in the background, even if you disconnect from SideCar.

So the most you can know for sure is that "SideCar is definitely NOT running" if you don't find avconferenced running.

The shell command pgrep -qx avconferenced will return an error if avconferenced if not running, so you can test for that in Keyboard Maestro like this: