Mangage Macbook Brightness and Automate Hub Setup

I'm looking to do the following upon plugging my Macbook into a Thunderbolt hub that is connected to an external display and toslink-connected speakers:

  1. Switch to mirrored display (this happens automatically at plugin).
  2. Set audio device to External SPDIF device (the speakers).
  3. Turn mirrored Macbook display all the way down to "off."

Is there a way to do automatically with Keyboard Maestro? If I could do this with a quick keypress, or prompt a macro via Alfred, that works too.

I don't have a dock, but I think there's a chance that connecting to a dock might trigger this macro:

And if so, that's half your problem solved.

1 Like

As @Sleepy notes, Keyboard Maestro cannot detect a Thunderbolt hub, but it can detect other things, like USB devices and mounted volumes and network changes. So if any of them happen at the same time, Keyboard Maestro could trigger a macro based on that.

After that, there are actions to increase and decrease the screen brightness, but you will need to use other tools like AppleScript to set mirroring and brightness.