I would like to run an automation as soon as a certain display gets connected to mac.
The display is not recognized as usb device but as display. So I would need a trigger that:
Recognizes a certain display (not all of them, so the count function doesn't work)
After searching through the forums I couldn't find a way.
So why on earth would you need a thing like that?
Real world use case
I do livestreaming on several macs. One of them is a macbook air.
As soon as I connect a "Elgato Cam Link 4k" to this macbook air, I would like it to run some actions.
The Cam Link gets connected through usb bus it not recognized as usb device anywhere in the systems report of the macbook air (m1 version). BUT it shows as a Display with the name "Cam Link 4k".
Is there a way to create a trigger that activates as soon as the display "INSERT DESIRED DISPLAY NAME HERE" gets connected? Since I have several displays monitors on this device, it should not trigger with any of the others.
The first paragraph of this reads “The Display Layout Changed trigger (v9.0+) executes when the display layout changes, for example when you rearrange your monitors, add or remove a monitor, or change screen resolutions.”
So perhaps you might want to investigate using this trigger and see what it gives you?
I wasn’t so much interested in the change to display layout, but the adding of your display as you were asking originally. Are you saying that this trigger doesn’t notice when you add/connect your display?
Well, the fact that it contains “Added” and it triggered just after you connected your display tells you the trigger relates to connecting that display. Do you connect/disconnect other displays at all, or just that one in particular? If it’s only the Cam Link then your macro could could have an If action along the lines of:
If %TriggerValue% contains “Added”
Then do Cam Link connected stuff
Otherwise do nothing
Yes, makes total sense.
Unfortunately I have 2 challenges with that:
As posted above I connect other displays to the macbook as well but this trigger should only run for the cam link (it will mess with background software in the end which should not happen with other displays).
I sync my macros for convenience between my macs and this trigger should only run on the macbook air, not on other macs when things get connected there (even a cam link connected to another mac should not trigger anything there)
Thanks for looking into this, I really appreciate your time and ideas.
At the top of your macro test the value of the KM token %MacName% - if it is not your MacBook Air, then quit the macro.
You actually said
which I took to mean they were permanently connected; you didn’t answer my question
If you’re saying you do connect/disconnect other displays as well as the Cam Link, then I’m not sure how to distinguish between them other than by possibly using the Screen related tokens. Have a look in the wiki here token:Screen [Keyboard Maestro Wiki].
I’m off now for some kip, maybe you’ll make some headway now or someone else can chip in. Cheers!
I didn’t need to watch your whole video - it is clear why you’re not getting the result you expect: neither %TriggerValue% nor %MacName% are variables so you can’t use them as if they are; they are both text tokens, therefore you need to use a text condition in your If action.
So at 1:38 in your video, for example, you should be choosing to add a text condition, not a variable condition and you should be specifying %TriggerValue% including the percent signs (and the same goes for the %MacName% token).