I connected Soundbar system to HDMI port (1), and I connected my monitor to Display Port (2). On windows I can mirror two outputs 3840x1600 and thanks to that have normal display on a monitor via display port and 5.1 audio on a sounbar (ignoring video). Ubuntu does not allow to mirror outputs at such high resolutions, and forces me to use side by side displays. But Yamaha soundbar is always detected as a first display, and my monitor is always detected as a 2nd display. I'm changing display settings to make 2nd monitor as a primary monitor, but it only works after login. While login the HDMI display is always treated as primary, and invisible because it is sound device :). How to force HDMI port to be always 2nd / 2ndary display? Or how to mirror 3840x1600 outputs in Ubuntu (Windows allows for it, both cables Display Port and HDMI port are capable of 8K output).
3 Answers
For at least Ubuntu 22.04:
- Log in and set the monitor layout
- Check inside the configuration file
~/.config/monitors.xmlif the tag<primary>yes</primary>is set in the right monitor. - Copy the configuration file from your user to gdm3 folder:
sudo cp ~/.config/monitors.xml /var/lib/gdm3/.config/ - Correct the owner of
monitors.xmlfile:sudo chown gdm:gdm /var/lib/gdm3/.config/monitors.xml - Reboot
gdm3 config folder is here -> /var/lib/gdm3/.config.
user .config folder is here-> /home/user/.config.
This worked for me.
- 323
- 7,474
After you've set your monitors, copy the configuration file ~/.config/monitors.xml into the folder of your display manager.
For gnome display manager, it would be: /etc/gdm3/
For lightdm, it would be: /etc/ldm/
This should allow you to set your main monitor to display the login part, not the background.
- 525
Here's a slightly more versatile version of @andré-m-faria's answer that uses ln to create a hard link to the user's monitors.xml instead of copying it, thus maintaining changes between the user's configuration and their login screen automatically. It is inspired by this answer, which responds to roughly the same question for a much earlier version of Ubuntu. It should be noted that gdm3 seems to fail to follow soft links, so a hard link must be used.
Copying and editing @andré-m-faria's answer:
For at least Ubuntu 22.04:
- Log in and set the monitor layout via the
Displaysdialog (pressSuper[often the Windows key] and typedisplayor find via theSettingsmenu). - Check inside the configuration file
~/.config/monitors.xmlif the tag<primary>yes</primary>is set in the right monitor. - Create a hard link to the configuration file from your user to gdm3 folder:
sudo ln ~/.config/monitors.xml /var/lib/gdm3/.config/. - Hard links share the same inode as the original file and thus all permissions, so the owner of the hardlink will be the user. In order to make sure that
gdm:gdmcan access it, runchmod o+r ~/.config/monitors.xml. - Reboot.
- 143
- 1
- 6