jakehilborn / displayplacer

macOS command line utility to configure multi-display resolutions and arrangements. Essentially XRandR for macOS.
MIT License
3.8k stars 136 forks source link

displayplacer

PRs Welcome
macOS command line utility to configure multi-display resolutions and arrangements. Essentially XRandR for macOS.

Download:

Install via Homebrew with brew install displayplacer or visit the releases tab.

Usage:

Show current screen info and possible resolutions: displayplacer list

Apply screen config (hz & color_depth are optional): displayplacer "id:<screenId> res:<width>x<height> hz:<num> color_depth:<num> scaling:<on/off> origin:(<x>,<y>) degree:<0/90/180/270>"

Apply screen config using mode: displayplacer "id:<screenId> mode:<modeNum> origin:(<x>,<y>) degree:<0/90/180/270>"

Apply screen config with mirrored screens: displayplacer "id:<mainScreenId>+<1stMirrorScreenId>+<2ndMirrorScreenId> res:<width>x<height> scaling:<on/off> origin:(<x>,<y>) degree:<0/90/180/270>"

Silence errors per-screen using quiet: displayplacer "id:<screenId> mode:<modeNum> origin:(<x>,<y>) degree:0 quiet:true"

Disable a screen: displayplacer "id:<screenId> enabled:false"

Instructions:

  1. Manually set rotations 1st*, resolutions 2nd, and arrangement 3rd. For extra resolutions and rotations read 'Notes' below.
    • Open System Preferences -> Displays
    • Choose desired screen rotations (use displayplacer for rotating internal MacBook screen).
    • Choose desired resolutions (use displayplacer for extra resolutions).
    • Drag the white bar to your desired primary screen.
    • Arrange screens as desired and/or enable mirroring. To enable partial mirroring hold the alt/option key and drag a display on top of another.
  2. Use displayplacer list to print your current layout's args, so you can create profiles for scripting/hotkeys with Automator, BetterTouchTool, etc.

ScreenIds Switching:

Unfortunately, macOS sometimes changes the persistent screenIds when there are race conditions from external screens waking up in non-determinisic order. If none of the screenId options below work for your setup, please search around in the GitHub Issues for conversation regarding this. Many people have written shell scripts to work around this issue. Recommended discussions are one, two, three, four, five, six.

You can mix and match screenId types across your setup.

Notes:

Backward Compatability:

displayplacer list output changed slightly in v1.4.0. If this broke your scripts, use displayplacer list --v1.3.0.

Feedback:

Please create a GitHub Issue for any feedback, feature requests, bugs, Homebrew issues, etc. Happy to accept pull requests too!