Skip to content Skip to footer
MacOS Multi-Display Swapping
MacOS Multi-Display Swapping

MacOS has a "flaw" when it comes to external displays. If you use two or more of the same exact model of display for your external displays, it will have trouble remembering your display settings. This is because MacOS, by default, doesn't read the display's serial number, instead, it reads the model number, causing it to be confused whenever you have more than one display with the same model.

The Problem

I'm currently using two Prism+ W280 Max 4K monitors at home with my MacBook Pro on clamshell mode. Since I do bring my MacBook Pro out on occasions, every time I come back and plug the monitors back into my MacBook, I would always have to re-open the MacOS display settings and reset the order, which monitor is the main monitor as well as enable the HDR mode for both monitors.

Why this happens?

The main reason this is happening is because MacOS not only doesn't care about display serial numbers, it also doesn't care which port the display is physically connected to. This means even if you were to connect the displays directly to the Mac via 1 HDMI and 1 USB-C, as long as it's the same display model, this issue will affect you.

There is also a race condition going on, which can be easily reproduced by using a dock, like I do. If you monitor the how the displays are shown, you can observe how MacOS labels the identical displays on a first come, first serve basis. This also means if you quickly unplug and re-plug the docker connector, it will start showing as {displayModelName} (3) and (4), because MacOS thinks the re-connected displays are 2 other display with the same model.

You can tell this gets irritating very easily, especially in the occasion that I have to leave house with my MacBook Pro more than once a day. At first, I found SwitchResX, and it seemed to work for awhile. But it is nowhere near stable and reliable.

This happened to me today, and SwitchResX only managed to fix the order and enabled the HDR of my right display. I thought to myself, this is it. I need to find a solution. Off to Google I go!

I then came across an article from superuser. The top comment mentioned to use displayplacer, a macOS command line utility to configure multi-display resolutions and arrangements.

The Solution

Write a Raycast script (optional) to run a bash command quickly that organize the displays in the right order, resolution as well as activate the HDR for all displays that support it.

TL;DR

Install Raycast, Brew, displayplacer and download ToggleHDR compiled binary.

Create a directory for the custom Raycast script we are going to write (skip if you already did) and move the downloaded ToggleHDR compiled binary into the Raycast script directory.

*Remember to do a chmod +x ToggleHDR from terminal so it is executable.

Open Raycast settings and go to Extensions, click the + icon and add the script directory and navigate to the directory you just created.

Open up your favourite editor and create a file named setDisplay.sh and save it to the directory created above, do not close the editor.

Install displayplacer via Brew with the following command:

brew tap jakehilborn/jakehilborn && brew install displayplacer

After displayplacer is installed, make sure your displays order and resolution is set properly how you want it to be organized. Run the below command, which lists all available resolution as well as a command at the end of the result with the current arrangement.

displayplacer list

Copy the command given to you (boxed in red above), and paste it into the setDisplay.sh.

Directly below the command pasted, add the path to the ToggleHDR binary to make the script execute it. Your script should now look like this:

#!/bin/bash

# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Set Display Correctly
# @raycast.mode silent

# Optional parameters:
# @raycast.icon 📟

# Documentation:
# @raycast.description Set the display to the right orientation and display settings
# @raycast.author {Your Name Here}
# @raycast.packageName System

displayplacer "id:7C4BA7BA-C39E-4948-AF43-363E46E2A93E res:2560x1440 hz:60 color_depth:7 scaling:on origin:(0,0) degree:0" "id:B3043154-7A55-4FA9-BA10-0B7890703F98 res:2560x1440 hz:60 color_depth:8 scaling:on origin:(2560,0) degree:0"

{Path to binary}/ToggleHDR all on

Save the script and reload Raycast script directory and you're done. Whenever the displays are jumbled, just use Raycast to run the script and all's back to order.

The North Face Kaban Backpack

Sign up for my newsletter

Be the first to know the latest updates