Developing software in the Real World

Keyboard shortcut to mirror displays on a Touch Bar Mac

One feature of the 16″ MacBook Pro that was new to me is the Touch Bar. This thing replaces the F-keys with a touch pad that adjusts itself to the app in use in order to provide useful shortcuts you can just touch.

This is all well and good, but when presenting, I use the cmd+F1 keyboard shortcut to toggle display mirroring. A useful Stack Overflow answer tells me that I can use cmd+{dim brightness} to do this. However, the dim brightness button isn’t displayed by default, so you have to touch the < button first to expand the “control strip” in order to see it. That’s a lot of brain cycles when you’re under the lights on stage. I want a simple keyboard shortcut!

While I returned that MacBook Pro for various uninteresting reasons, I thought I’d document the solution I came up with so I can look this up again when/if I have a laptop with a Touch Bar again.

Further googling led me to the mirror-displays project. This provides a command line tool (mirror.zip) that will do exactly what we need as it’s a toggle:

All we need to do is hook it up to a keyboard short cut.

My preferred choice at the moment for this sort of thing Keyboard Maestro. I created a simple macro that did exactly what I wanted:


Screenshot of Keyboard Maestro macro that toggles mirror mode

I mapped this to the keyboard shortcut shift+cmd+§ as on my keyboard § is right next to the 1, below the esc and so in the same general vicinity as cmd+F1.

I find that giving presentations takes a lot of cognitive effort, so changing a keyboard shortcut means new muscle memory which is always a risk when on stage. Personally, the way I help myself with this is to perform all the steps including mirroring for demos when I practice my talks before I go on stage.

This one will take a few more practice runs, but hopefully I’ll then look like I know what I’m doing as I seamlessly switch to mirror mode when demoing and then back to normal for my slides with presenter display.

2 thoughts on “Keyboard shortcut to mirror displays on a Touch Bar Mac

  1. If you replace the brightness slider with the dimmer/brighter buttons, you can then press Fn-Cmd-Dimmer to toggle Mirror mode. You'll also need to replace the keyboard preference for which strip is displayed when the Fn key is pressed to "Expand Control Strip".
    Why this wasn't left alone, I'll never know, but this will work for those folks who don't have Keyboard Maestro.

Thoughts? Leave a reply

Your email address will not be published. Required fields are marked *