Code for an Adafruit Trinket to emulate the Cmd-F1 keypress to toggle display mirroring on Macs.
See blog post at http://seb.ly/2017/06/calling-all-spea…isplay-mirroring/ for full instructions
To compile the code :
Install Arduino and the Trinket board as described at Adafruit : https://learn.adafruit.com/adafruit-arduino-ide-setup/overview (Arduino 1.6+ recommended)
Download or clone the entire repository.
In your Arduino Preferences, select the "Arduino" folder in this repository as the sketch folder. Restart the Arduino IDE just to be sure.
Open the file in the Sketchbook CmdF1Emulator. Follow the instructions at Adafruit to upload the sketch on to your Trinket. (Make sure to choose the correct board and programmer, and press the Trinket button to start the bootloade).