macOS How do I install and use this program?
Installation:


Download the zip to your Downloads folder
Unzip displayplacer-master.zip
Enter in Terminal: sudo mv ~/Downloads/displayplacer-master/displayplacer /usr/local/bin/
sudo chmod +x /usr/local/bin/displayplacer
displayplacer
Depending on your Security &amp; Privacy settings you have to allow execution of the file in System Preferences > Security &amp; Privacy > General


All other files included in the zip won't be required to run the exec.

Usage:


Get the properties of all your displays: displayplacer list
With the properties and the various possible switches create an arrangement. One example with four monitors is listed:

displayplacer "id:18173D22-3EC6-E735-EEB4-B003BF681F30+F466F621-B5FA-04A0-0800-CFA6C258DECD res:1440x900 scaling:on origin:(0,0) degree:0" "id:4C405A05-8798-553B-3550-F93E7A7722BB res:768x1360 hz:60 color_depth:8 scaling:off origin:(1440,0) degree:90" "id:A46D2F5E-487B-CC69-C588-ECFD519016E5 mode:3 origin:(-1440,0) degree:270"


I have no 2nd screen in my virtual machine so I partly have to guess what it means:

The first two monitors (1440x900) are mirrored and contain the menubar. The third is on the right and rotated by 90 degrees (clockwise?). The fourth is on the left and rotated by 90 degrees (counterclockwise?).


Automator:

After finding appropriate settings (at least two if you want to switch the primary display between [your] macbook's internal display and [your] external display: back and forth) you have to create two different services/quick actions/etc. each containing one shell script ("Run Shell Script") with the proper displayplacer "id:.... line.

Depending on your Mac hardware and your system version you can apply a shortcut or even add it to the Touch Bar.