Planet Linux Mint

2015.08.28

Segfault

Configuring the MDM login screen for multiple monitors

Introduction

A lot of people using multiple monitors ask why their login screen appears on the wrong monitor, why can’t it use all of them, how to change its resolution and why the login screen simply doesn’t follow the configuration they set in Cinnamon, MATE, Xfce or KDE.

Well, it’s simple really… but not obvious. So let me explain the why first, and then we’ll look at the how :)

Why the MDM login screen doesn’t follow your Cinnamon/MATE/Xfce/KDE settings

Pretty much all desktop environments provide comfortable tools to configure your monitors. For instance in Cinnamon, it looks like that:

Screenshot from 2015-08-28 16:49:53

It works quite well.. but there’s two problems with it:

  • It doesn’t configure Xorg directly, it configures the desktop environment itself. In the case of Cinnamon, it writes that configuration in ~/.config/monitors.xml and that is read by Cinnamon after you log in.
  • It doesn’t configure things system-wide, but only for you (i.e. for the current user).

MDM, which is responsible for the login screen, is run as root, for all users, and it has nothing to do with particular desktop environments (which may write their monitor configuration in completely different formats). The way MDM shows you the login screen is simply according to the default Xorg configuration.

How to tell MDM to use a particular monitor

If you launch the “Login Window” tool, or if you type “sudo mdmsetup”, you can configure MDM to use a particular monitor rather than what Xorg recognizes as the primary one.

Screenshot from 2015-08-28 17:04:43

How to configure MDM’s resolution and layout

MDM launches Xorg and then runs the script /etc/mdm/Init/Default. So to configure MDM, you can either configure Xorg, or add commands (such as xrandr calls for instance) to /etc/mdm/Init/Default.

If you’re using the ATI or the NVIDIA drivers, you can probably use the configuration tool they provide to set up Xorg.

I like MDM to show up mirrored on all my monitors for instance, so in my NVIDIA settings, I select my second monitor and I set its “Position” to “Same as”.

Screenshot from 2015-08-28 17:17:06

I then click on “Save to X Configuration File” and I use that to merge the configuration into /etc/X11/xorg.conf.

If I was using an Intel card and I couldn’t rely on the NVIDIA configuration tool, I’d probably use xrandr instead.

A few words on xrandr

Xrandr is very useful and you can mess with it in your current session, first to see if your gaphics card supports it, and second to find the xrandr command line which will give you the monitor layout/resolution/configuration you want.

Here’s an example:

clem@storm ~ $ xrandr
Screen 0: minimum 8 x 8, current 5120 x 1440, maximum 16384 x 16384
DVI-I-0 disconnected (normal left inverted right x axis y axis)
DP-1.8 connected 2560x1440+2560+0 (normal left inverted right x axis y axis) 553mm x 311mm
   2560x1440      60.0*+
   2048x1152      60.0  
   1920x1200      59.9  
   1920x1080      60.0     59.9     50.0     30.0     25.0     24.0     60.1     60.0     50.0  
   1680x1050      60.0  
   1600x1200      60.0  
   1280x1024      75.0     60.0  
   1280x720       60.0     59.9     50.0  
   1200x960       59.9  
   1152x864       75.0  
   1024x768       75.0     60.0  
   800x600        75.0     60.3  
   720x576        50.0     50.1  
   720x480        59.9     60.1  
   640x480        75.0     59.9     59.9  
DP-1.1.8 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 553mm x 311mm
   2560x1440      60.0*+
   2048x1152      60.0  
   1920x1200      59.9  
   1920x1080      60.0     59.9     50.0     30.0     25.0     24.0     60.1     60.0     50.0  
   1680x1050      60.0  
   1600x1200      60.0  
   1280x1024      75.0     60.0  
   1280x720       60.0     59.9     50.0  
   1200x960       59.9  
   1152x864       75.0  
   1024x768       75.0     60.0  
   800x600        75.0     60.3  
   720x576        50.0     50.1  
   720x480        59.9     60.1  
   640x480        75.0     59.9     59.9  
DVI-I-1 disconnected (normal left inverted right x axis y axis)
HDMI-0 disconnected (normal left inverted right x axis y axis)
DP-0 disconnected (normal left inverted right x axis y axis)
DVI-D-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
clem@storm ~ $ xrandr --output DP-1.8 --same-as DP-1.1.8

The first command asks xrandr to list what’s currently connected. In this example I’ve got two monitors, one recognized as primary on my display port “DP-1.1.8″ and the other on my display port “DP-1.8″.

The second command tells xrandr to set “DP-1.8″ as a mirror of “DP-1.1.8″. When I run that I basically end up with mirrored screens, two mouse pointers etc.. which is exactly what I want for my MDM login screen.

All I have to do then, to get MDM to mirror my screens, is to add that second command to /etc/mdm/Init/Default.

There’s a lot you can do with “xrandr”. If your card supports it and you’re not able to use a graphical tool, check the xrandr man page.

You can also use a graphical tool called “arandr” (which you can install from the Software Manager, or in a terminal by typing “apt install arandr”).

Screenshot from 2015-08-28 17:38:39

Arandr shows you your monitors. Place them the way you want (put them on top of each others for mirrored displays), rotate them, set their resolution etc… click on Layout->Apply to make sure that works, and when you’re ready click on Layout->Save As to save the resulting xrandr command to a file.

Open that file then, get the xrandr command from it and place it in /etc/mdm/Init/Default.

by clem at 2015.08.28 04:40 PM