Score:2

With Wayland, how can I mirror two displays and extend a third?

us flag

I want to mirror two displays (laptop and left display) and extend a third (right display).

If that is unclear, I found a substantially equivalent question at How to "overlay"/clone displays in GNOME Wayland that includes some handy images showing two displays are mirrored and one is extended.

Sadly, the only answer was to try something manual. Under Xorg, it is easy to do this with xrandr so I am disappointed that I don't find a simple solution in Wayland / Ubuntu 22.04.

I found a "manual" and quite ugly solution, but I hope there is a better way. I will eventually post the manual solution in detail if there are no better options. In brief, I saved ~/.config/monitors.xml multiple times while changing config, inferred which configuration was active and how to mirror two displays, edited a single <logicalmonitor> to contain the two <monitor> instances that are mirrored, and rebooted.

Score:0
us flag

I'm at the office and doing this again, so here is the (painful) process that functions as a workaround. First generate diffs to locate the configuration to edit (my monitors.xml had 8 configurations, so it was not easy to spot what to edit). To make this easier, ideally put the primary monitor in the correct location. Otherwise, it is easy to accidentally delete the <primary>yes</primary>, which will break the workaround.

cd ~/.config
cp monitors.xml monitors.xml.before
gnome-control-center  # move a display and apply the changes
diff monitors.xml monitors.xml.before  # to confirm/locate the change

Once you have successfully caused a change to the <configuration>, you can look at the diffs to determine which <configuration> block you need to edit. Beware that most diff tools are not xml savvy, so you may see the diff start and stop in the middle of xml blocks (<x>...</logicalconfiguration></configuration><configuration><logicalconfiguration> instead of <configuration><logicalconfiguration><x>...</logicalconfiguration></configuration>)

Edit as follows:

  1. Open ~/.config/monitors.xml
  2. Find the section that was edited
  3. Pay attention to the offsets of the <logicalmonitor> sections and use this information to locate the incorrectly placed monitor. In my case, I have two of the displays where I want them (at <x>0</x> / <y>0</y> and at <x>1980</x> / <y>0</y>) and I have a third that is in the wrong location (at <x>3840</x> / <y>830</y>)
  4. Cut the entire <logicalmonitor>...</logicalmonitor> section that is in the wrong location and paste it into a second document (to remove it from monitors.xml and to keep it accessible for the next step)
  5. Copy only the <monitor>...</monitor> section from the second document
  6. Paste the content copied from #5 just before or after the existing <monitor>...</monitor> line in the section that you want to be mirrored.
  7. Confirm that one (and only one) of the <logicalmonitor> sections contains <primary>yes</primary>.
  8. Make a backup of monitors.xml, since an error will cause Gnome to wipe the file, losing all of your other configurations (if it's a laptop and you use multiple external displays).
  9. Reboot, log in to Gnome, and hopefully you will see your new configuration.

Note: you can paste into a section with <primary>yes</primary> and mirror the primary display. If you cut from the section containing this, you need to copy/paste it as well. This line is after <scale>1</scale> (or whatever your scale is) and before the first <monitor> in the <logicalmonitor> section.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.