One thing that bugs me about switching main monitors in MacOS is that there’s no shortcut to do it. You have to go into settings and drag that little bar to the display that you want to be main.
I’ve got a setup where my iMac is on a standing desk and my second monitor is on my normal desk, and using the wireless keyboard and mouse I can either stand or sit. When I’m sitting I want my external monitor to be the main, when I’m standing I want my iMac to be the main. Using Alfred and displayplacer, I was able to set up a nice quick switch.
- Install displayplacer
- Set your monitor configuration up the way you want for your first configuration (in my example, it was with my iMac as the main monitor)
displayplacer listThis will give you the displayplacer command to switch to that configuration. Copy it into a text file and label it for later use.
- Switch your monitor configuration to your second configuration (in my example it’s my external monitor is the main monitor)
displayplacer listagain. This will give you the displayplacer command to switch to that configuration. Copy and label it like in step 3.
- Now open up Alfred* and make a new Workflow. Use the starter template
Keyword to Script
- Double click the keyword box and enter in a name and keyword you want to use to switch to the configuration. In my case, I wanted to type “imac main” in Alfred to make the switch.
- Double click the script box and enter the
displayplacercommand from the previous step for your first configuration. You may notice the command I pasted is slightly different than the command I got from the terminal. That is because Alfred initially couldn’t find the
displayplacercommand, but adding its full path
/usr/local/binfixed that problem.
- Repeat steps 7 and 8 with the second configuration.
- Boom! You can now use Alfred to switch between monitor configurations.
* While I used Alfred, it does cost money so if you’re looking for a free solution, it is possible to do within the MacOS Automator app. I originally set it up using that and tied it to a keyboard shortcut, but found that it sometimes conflicted with whatever app I had in the foreground.