[RESOLVED] Understanding and using Functions/tokens for Displays

tldr: How to retrieve information of specific Monitor/hardware connected/turned on, on Mac to use it as a trigger for a Shortcut.


first and foremost, I am really new into Keyboard Maestro and I am still in the phase of understanding the potential of the application and even after reading some parts of the wiki and watching some Videos, I am only scraping the surface, so bare with me, if this is easy for you, I try to learn as quickly as possible, haha.

My request:

  • I am using lunar.app to control my Monitor Setup on my Mac Studio.
  • I am using the latest Version of KM v11.0.2 on macOS Sonoma 14.3.1

I created a Shortcut in the shortcuts.app which cycles through my Monitors to turn them off, when needed.

  • When needed means, when I turn on my TV (connected to my Mac Studio with HDMI), all other Monitors (2x LG) should turn off. So the trigger is: When TV is turned on/connected. Right now I am using Shortery for this, to automate the process --> When TV turns on, run shortcut to turn off my monitors.

Now my question: I am trying to understand the logic/behaviour behind this in KM. If I am not completely wrong the initial trigger is: "The Display layout changes". There are Display Layout changes trigger which then refer to additional tokens, values etc. The whole variables in the Wiki are so detailed, that I am currently not able to get that simple information out of it, because KM's potential is far too big at the moment for me, haha.

So, after this wall of text, is there a specific way, to filter for a specific Monitor and only if that specific Monitor turns on, run my Shortcut with KM? ) I want to consolidate different automation processes on my Mac to fewer ones, thats my intention of ditching Shortery for KM in this case.

Thanks in advance for any help it is much appreciated.

Hey there, welcome to the forum!

You should be able to use an If Then Else action to see if a particular monitor is connected based off it’s resolution (assuming there are not two monitors that share the same resolution).

For instance, the action in the screenshot below tells me if my external monitor is connected by telling me it’s resolution is listed in the %Screen%All% token.

Action Screenshot (click to expand/collapse)

1 Like

Hi, thanks for the quick reply @cdthomer I was able to retrieve the information and get it into the workflow of KM. It seems to be working now! :smiling_face_with_three_hearts: