Configuring the MDM login screen for multiple monitors
by clem 21

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:

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.

21 thoughts on “Configuring the MDM login screen for multiple monitors

  1. clem Aug 28,2015 16:56

    Now.. if I put my developer hat on.. you might wonder why each desktop environment provides its own tool instead of having a common administration tool which sets Xorg directly and for everybody..

    I guess historically first, GNOME and KDE were much more innovative and had more momentum than individual and/or cross DE projects.

    Another thing to consider are remote users. Say you’re logging in from a remote computer, or a light-client (terminal) .. then you might not want to use the same settings as other users.

    So there’s probably a reason why this is the way it is and why it’s user-specific and DE-specific.

    With that said though, I wouldn’t mind if we could add a feature to these. Say a little button to “Apply to Xorg configuration”. Or in the login screen configuration tool, to “Apply current monitor settings to MDM”.

    I don’t know.. we need to think about all that. At least it’s explained now, and we can certainly help to improve things a bit going forward.

  2. Danny Michael Aug 29,2015 00:57

    Finally my login screen isn’t in 640×480. Can’t thank you enough for this little tidbit. Thank you!

  3. Cory Hilliard Aug 29,2015 04:00

    I swear, it’s like you live in my mind! Right now, When I try to login, my GUI locks up when I have multiple monitors plugged in. I then have to reboot, unplug the monitors, login, then plug them back in. So a fix like this is awesome.

  4. noname poster Aug 29,2015 10:39

    Why you dont wont to make gui tool for setting mdm screen parameters? Or you can make it like in last ubuntu – login on one screen and zoomed on all place wallpaper on another (without ugly black space)?

  5. mrman Aug 31,2015 15:07

    if you do make a login screen gui tool, would it be possible on dual and tripple ( hey even quad ) screen setups to allow for one monitor to display the login screen and the other one ( or two ) to still display an image.

    i.e if i have an eyefinity / nvidia surround or just dual head monitor setup and set a 3840 x 1080p wallpaper, could your utility display the image correctly across the two 1080p screens ( a bit like the wallpaper manager should do ) but just have the login gui on the left or the right or the center.

    thanks

    • clem Aug 31,2015 15:29

      I think you can do that already.. give it a shot (mileage may vary between the GTK/GDM/HTML greeters, let us know if you find limitations).

  6. roger0111 Sep 6,2015 12:51

    I have Linux Mint installed on a laptop. I often switch between these modes:
    1) The single built-in display
    2) Dual Monitors connected to a docking station
    3) Display port to my big screen TV for watching streaming shows and movies. Once in the mode, I then have to adjust the scale to make the desktop fit.

    I like the idea of setting a default monitor configuration, but
    it would also be nice to be able to “Save” your other monitor configurations as well. When start up your system or session, MDM detects your monitor setup, then automatically goes with the matching saved config that is stored.

    • clem Sep 7,2015 08:38

      That’s what Cinnamon (and MATE/GNOME) does. It has a configuration saved for each ever plugged set of monitors.

      • Andreas Jan 25,2016 16:44

        Hi Clem,
        I have the same problem, but Cinnamon does not appear to save the settings. I have an external screen connected to my laptop and everytime I reboot I have to login and then change the display settings again. Is there some way of fixing this?

    • mika Jan 25,2016 00:59

      it’s possible. you have to create a xorg.conf file et edit it http://community.linuxmint.com/tutorial/view/877

  7. Roliverio Sep 23,2015 12:47

    I’m having an annoying issue with MDM, it won’t start any session.

    If i revert back to GDM3 or even LightDM all works accondingly. (note that all the .session files are untouched and MDM’s config is vanilla)

    Im also observing segfaults on it. I was unable to find a proper bug tracker to report the issue, care to provide a link?

  8. foolishmountainman Oct 4,2015 20:30

    Hi, I would like to disable the login selection where one must type in the username as well as the password. I don’t touchtype and must look at the keyboard. Consequently I sometimes look up and find my passwird in large plaintext in the enter username box. Yes I know this is my own clumsiness, but it could be avoided if that login prompt never came up.

    Can this be done?

    • NJ Jan 28,2016 00:50

      This problem has been reported already on the Cinnamon bugtracker. I tried to find where but, alas, gave up after a few searches failed to find it. Developers, can you help (in any way)?

  9. Gabriel Longo Nov 1,2015 09:41

    Very nice news, thank you,
    I wanted even before a way to keep the login screen on one monitor.

    Clem, taking advantage of the subject of multiple monitors I will informally report a bug:

    When using Cinnamon bar at top, and secondary monitor with higher height than the main display, some apps like KDE Apps (Krita, Kdenlive) or Wine Based Apps (teamviewer) will display menus from toolbar in the wrong place. Being more specific: The menus will be displayed in the position that they should be displayed at main monitor, however in this case the window is maximized in the secondary monitor.

    Sorry for not very good English and
    Once again congratulations for this project, thank you!

  10. mika Jan 25,2016 00:56

    xrandr setting will not stay at restart. it’s an important bug because generic screen just give a max resolution and there is no more xorg.conf file. so we have to create one with the wanted resolutions added in. very great thank you to this guy. or, like many people, I had forgiven. my screen was so small after my screen was not recongnised and no possibility to change it. I helped 3 people, in 2 days, with this link, on the hexchat. http://community.linuxmint.com/tutorial/view/877

  11. Gary Jul 14,2016 14:54

    I have a 3840×2160 laptop and two 1920×1080 external monitors. I have set all three as 1920×1080 in /etc/mdm/Init/Default. Upon reboot, the laptop screen shows the full greeter page but the external monitors only shows the top left quarter of the page. Any thoughts?

  12. MWave6 Jul 18,2016 00:24

    Hi All,

    Clem, I’ve posted an issue with MDMSETUP on the Mint forums w/screenshots thusly: https://forums.linuxmint.com/viewtopic.php?f=206&t=225700

    Long story short, I’ve got a Gigabyte Radeon R7 250 board to which I’d initially connected only my Samsung 19″ display via VGA and all was well. Last week, I also connected a new LED TV to the HDMI port and all is still well, with one caveat… MDM chooses the HDMI port as primary monitor and my login screen always goes there, requiring me to turn on my TV prior to booting Linux.

    You can see in my Mint post above that my MDMSETUP has no “Primary monitor” field whatsoever on the Options screen. I’ve noticed a “PrimaryMonitor=None” entry in /etc/mdm/mdm.conf and also /usr/share/mdm/distro.conf. Have set each to “PrimaryMonitor=VGA-0” and noticed that this DOES add a “Primary monitor” field in MDMSETUP; However, the pull-down is blank and has no actual options to choose.

    Furthermore, I get the warning/error output below when running MDMSETUP which leads me to believe something isn’t right or needs updated. I did experiment with removing MDM and installing GDM which hosed things up altogether. Booted into recovery mode and was able to reinstall MDM via command line.

    mdmsetup[3317]: Gtk-CRITICAL: IA__gtk_label_get_label: assertion ‘GTK_IS_LABEL (label)’ failed
    mdmsetup[3317]: Gtk-CRITICAL: IA__gtk_label_set_use_markup: assertion ‘GTK_IS_LABEL (label)’ failed
    mdmsetup[3317]: Gtk-CRITICAL: IA__gtk_label_set_label: assertion ‘GTK_IS_LABEL (label)’ failed
    mdmsetup[3317]: Gtk-CRITICAL: IA__gtk_label_get_label: assertion ‘GTK_IS_LABEL (label)’ failed
    mdmsetup[3317]: Gtk-CRITICAL: IA__gtk_label_set_use_markup: assertion ‘GTK_IS_LABEL (label)’ failed
    mdmsetup[3317]: Gtk-CRITICAL: IA__gtk_label_set_label: assertion ‘GTK_IS_LABEL (label)’ failed

    My xrandr output is as follows with available screen resolutions omitted for brevity. OS is Mint v18 (GA updated from beta via Update Manager) w/kernel 4.4.0-31

    HDMI-0 connected (normal left inverted right x axis y axis)
    DVI-0 disconnected (normal left inverted right x axis y axis)
    VGA-0 connected primary 1280×1024+0+0 (normal left inverted right x axis y axis)

    Have you run into anything similar that you might be able to point me in the right direction for next steps? I’m probably going to set my user to auto-login as a temporary workaround, but I’d really like to have some control over this… TIA!

    • Colby Sep 11,2016 08:37

      I’m having the blank Primary Monitor drop down issue for Login Window too.

    • Colby Sep 12,2016 05:45

      Adding xrandr –output DVI-0 –primary to /etc/mdm/Init/Default worked for me (Mint 18 64 bit).

  13. Alex Jan 8,2017 19:57

    Im having a similar issue. When I open mdmsetup, the “primary monitor” option is here but empty. I cannot select anything. We just entered 2017 and still need to open config files in order to select a bloody screen. This is just embarrassing.

Comments are closed.