[DM] Multi-monitor configuration

When having multple monitors on system boot, your Display Manager (SDDM, LightDM, GDM etc) will usually not display correctly in respect to your configured Xorg settings, if not configured properly.
To fix this, a popular and fairly proper and easy method is to use an Xsetup script for your Display Manager.

Xsetup script is a script (executable) file that includes some instructions to the Xorg server, just before starting the Display Manager

Here are these settings for SDDM and LightDM, while they can be adapted/adjusted easily for other DMs.

Create Xsetup script

Create a text file as and make it executable.

sudo touch /etc/X11/xorg.conf.d/dm-multimonitor.sh
sudo chmod +x /etc/X11/xorg.conf.d/dm-multimonitor.sh

Paste these contents and save.

The example is for two monitors, checking if one is not connected and applying relevant settings with xrandr command. You should edit these commands, according to your own actual setup.

# get the correct actual monitor names with
# xrandr | awk ' /connected/ { print $1, $2 }'
# Uncomment the sleep command, if you face problems, as a possible workaround
# sleep 3
if xrandr | grep "$mon2 disconnected"; then
    xrandr --output "$mon2" --off --output "$mon1" --auto
elif xrandr | grep "$mon1 disconnected"; then
    xrandr --output "$mon1" --off --output "$mon2" --auto
    xrandr --output "$mon1" --auto --output "$mon2" --right-of "$mon1" --auto

Add custom DM setting

Create a file as

  • For SDDM
  • For LightDM

with the following contents

  • For SDDM
# Path to a script to execute when starting the display server
  • For LightDM

Now you are ready to restart your Display Manager to see the results.
Log out your session, or you will see it at your next boot.

More examples

  • With 4 monitors on Intel-Nvidia 1050 in Prime setup

Forum kindly sponsored by