DEV Community

Giridharan Manivannan
Giridharan Manivannan

Posted on

Edit display layout on Macos with displayplacer

Having a giant external monitor is great, love the extra real estate that you get. But it's pesky when you need to switch your mac close-by or switch it back into the dock.

Add to this a constant need to ensure your layout matches the physical arrangement, and you end up with a silly amount of time navigating Displays > Arrange and making the layout look just right.

And it has been a terrible experience all round, until recently when I ran into displayplacer. They describe themselves as XRandR for Macos and that's it. Problem solved.

Once you install displayplacer, You can have any number of display layouts and arrangements configured, whose config you can gather up as a command which looks something like the below.

displayplacer "id:BCXXXXXX-DXXX-4XXX-8XXX-D1XXXXXXXXXX res:3008x1692 hz:60 color_depth:8 enabled:true scaling:on origin:(0,0) degree:0" "id:37XXXXXX-2XXX-0XXX-BXXX-8FXXXXXXXXXX res:1512x982 hz:120 color_depth:8 enabled:true scaling:on origin:(957,1692) degree:0"
Enter fullscreen mode Exit fullscreen mode

The command looks unwieldy at first, and it can get can get increasingly longer the more displays you have. The above is an example of a two display setup, but this illustrates the point.

However, To make it's usage a lot easier, the list subcommand, gives you options for each device and layout and even more helpfully, returns the current config as the above string.

So, once you have each of your arrangements as a displayplacer command, save it as an alias to each config and you can switch between each from the terminal or as a result of any automation that you set up.

Top comments (0)