Automating changes to Display arrangements on macOS

Now that I use Sidecar to turn my iPad Pro into a second screen I got a bit tired of going to the display preferences to change where my iPad was physically sitting each time. Since I am hot desking I have to put it on the left or the right and that changes almost daily.

Originally, I thought I would fix this would Keyboard Maestro but it can’t change the display layout and it is too hard to automate it to do the preferences.

I found a stack exchange thread with a link to displayplacer. This is a command line tool that can be installed by homebrew which will do the job of display preferences.

After following the instructions to install the tool you can capture your current screen configuration and then run a command to switch.

I created a Keyboard Maestro macro that monitors when the iPad is plugged in and then prompts me to turn on sidecar and choose the side of the desk where the iPad sits.