I figured out how to automate the display switching using a keyboard shortcut with displayplacer
and it works like a charm!😎
I setup a macro using Keyboard Maestro to automatically cycle the desktop arrangement using a keyboard shortcut.
Instructions to setup Keyboard Shortcut
- Install displayplacer using Homebrew
- Use Keyboard MeastroMaestro and create a Macro
- Add the Execute Shell Script Action for each display you have (I have 3).
- Open System Preferences > Displays and change your arrangement by placing the menu bar to the right by 1 screen (right-to-left type direction)
- Open your terminal and run the
displayplacer list
command - Copy the bottom output, e.g.
displayplacer "id:<screenId> res:<width>x<height> hz:<num> color_depth:<num> scaling:<on/off> origin:(<x>,<y>) degree:<0/90/180/270>"
- Paste the output into your Macro Action.
- Repeat steps 4-7 and stop after you've done the main screen you keep your menu bar on.
- Setup a keyboard shortcut for your Macro.
- Run your Macro with your new shortcut and watch the magic happen right before your eyes.
Helpful Tips
If you have an issue with running
displayplacer
from Keyboard Maestro, it's likely that you're using a different bash in your terminal/iTerm like oh-my-zsh when you installed it using Homebrew. If thats the case, follow these instructions from my other post to fix yourdisplayplacer
binary reference.Here's a screenshot to view my working Keyboard Maestro setup with
displayplacer
.You may need to run your macro a second time if you accidentally hit your shortcut.