[TUTORIAL] Make Log in Screen (LightDM) use same Display Properties as When Logged in

Write tutorials for Linux Mint here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials, start your own topic in the appropriate sub-forum instead. Before you post please read this
Post Reply
mattlach
Level 4
Level 4
Posts: 291
Joined: Mon May 30, 2011 8:34 pm

[TUTORIAL] Make Log in Screen (LightDM) use same Display Properties as When Logged in

Post by mattlach »

Hey everyone,

I recently figured this one out, and figured I'd document it here for posterity.

If you are anything like me, you have multiple screens rotated in different directions which works fine once logged in, but your log-in screen is all messed up.

As an example, here is how I have my screens set up in Cinnamon:
01.png
A 20" 1600x1200 screen in portrait rotated counter clockwise on the left
A 43" 3840x2160 screen in lanscape in the center
Another 20" 1600x1200 screen in portrait rotated clockwise on the right.

Lets just say that on the system login screen (LightDM) the screens are not configured like this, and if you knock your mouse pointer off the center one, it can be surprisingly difficult to get it back, tilting your head sideways and trying to navigate the pointer to the right place.

It also looks cleaner if your login matches the layout you want, so here is how to achieve that.

1.) Configure your screens how you want them in the Display properties settings.

2.) Install and use arandr to create an xrandr string from your preferred layout.

Open a terminal and do the following:

Code: Select all

sudo apt update
sudo apt install arandr
Run arandr from the GUI menu:
02.png
You should see your screen layout as you have it configured.

If you are happy with it as is, then save it to an xrandr string:

Layout Menu -> Save As

Save it somewhere you know where it is, and name it something nice. I chose to put it on my Desktop and name it "lightdm_xrandr.sh"


3.) Prepare the file containing your xrandr string for use:


The file contained my somewhat semi-complicated xrandr string:

Code: Select all

#!/bin/sh
xrandr --output DisplayPort-0 --primary --mode 3840x2160 --pos 1200x0 --rotate normal --output DisplayPort-1 --mode 1600x1200 --pos 0x560 --rotate left --output DisplayPort-2 --off --output HDMI-A-0 --mode 1600x1200 --pos 5040x560 --rotate right
Unless you have the exact screen layout I do, yours will look different.

For good measure I decided to edit it and add an "exit 0" to the end. This is probably not necessary, but it is proper.

Code: Select all

sudo nano ~/Desktop/lightdm_xrandr.sh

Code: Select all

#!/bin/sh
xrandr --output DisplayPort-0 --primary --mode 3840x2160 --pos 1200x0 --rotate normal --output DisplayPort-1 --mode 1600x1200 --pos 0x560 --rotate left --output DisplayPort-2 --off --output HDMI-A-0 --mode 1600x1200 --pos 5040x560 --rotate right
exit 0
after saving, we should check to make sure it is executable. arandr seems to do this by default, but it doesn't hurt to check:

Code: Select all

# ls -l ~/Desktop/lightdm_xrandr.sh
-rwx------ 1 matt matt 263 Oct 22 23:38 lightdm_xrandr.sh
-rwx------ -> Read Write eXecute. Permissions are correct (in Mints default bash config the file should also be listed as green if it is executable)

If it is not executable you can make it so with the following command:

Code: Select all

chmod 700 ~/Desktop/lightdm_xrandr.sh
Then move this script to /etc/lightdm

Code: Select all

sudo mv ~/Desktop/lightdm_xrandr.sh /etc/lightdm/
So now we have a "script" that sets the proper screen orientation. Now we have to tell lightdm to execute it on startup.

4.) Tell lightdm to execute your xrandr string on boot:

First we have to find the config file. Since the file may differ by version or specific configuration, rather than tell you which file I edited, I will show you how to find yours, just in case yours is different.

Run lightdm --show-config to display the current configuration.

Code: Select all

# lightdm --show-config

   [Seat:*]
A  allow-guest=false
C  greeter-wrapper=/usr/lib/lightdm/lightdm-greeter-session
D  guest-wrapper=/usr/lib/lightdm/lightdm-guest-session
E  xserver-command=X -core
F  greeter-session=slick-greeter
G  user-session=cinnamon

   [LightDM]
B  backup-logs=false

Sources:
A  /usr/share/lightdm/lightdm.conf.d/50-disable-guest.conf
B  /usr/share/lightdm/lightdm.conf.d/50-disable-log-backup.conf
C  /usr/share/lightdm/lightdm.conf.d/50-greeter-wrapper.conf
D  /usr/share/lightdm/lightdm.conf.d/50-guest-wrapper.conf
E  /usr/share/lightdm/lightdm.conf.d/50-xserver-command.conf
F  /usr/share/lightdm/lightdm.conf.d/90-slick-greeter.conf
G  /etc/lightdm/lightdm.conf.d/70-linuxmint.conf
Look for a config file that says something about "slick greeter". In my case this was:
/usr/share/lightdm/lightdm.conf.d/90-slick-greeter.conf

Edit this file:

Code: Select all

# sudo nano /usr/share/lightdm/lightdm.conf.d/90-slick-greeter.conf
By default it should look like this:

Code: Select all

[Seat:*]
greeter-session=slick-greeter
Add this line between [Seat:*] and greeter-sessiion as follows:

greeter-setup-script=/etc/lightdm/lightdm_xrandr.sh

Code: Select all

[Seat:*]
greeter-setup-script=/etc/lightdm/lightdm_xrandr.sh
greeter-session=slick-greeter
Reboot. Your login screen should now be oriented the same as your desktop once logged in.

I hope this helps someone else.
Corsair 1000D, Threadripper 3960x, Asus ROG Zenith II, 64GB, 2TB Phison E16, AMD Radeon 6900XT, 43" Asus XG438Q, 2x Dell 2007FP, Schiit Bifrost Multibit DAC
Server: 2x E5-2650v2 (16C/32T), SuperMicro X9DRI-F, 256GB RAM, 120TB ZFS
User avatar
SMG
Level 23
Level 23
Posts: 18901
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: [TUTORIAL] Make Log in Screen (LightDM) use same Display Properties as When Logged in

Post by SMG »

mattlach wrote:
Sun Nov 07, 2021 3:56 pm
I hope this helps someone else.
It did. I recommended your tutorial to someone with a slightly different issue and it worked for them .
Image
A woman typing on a laptop with LM20.3 Cinnamon.
mattlach
Level 4
Level 4
Posts: 291
Joined: Mon May 30, 2011 8:34 pm

Re: [TUTORIAL] Make Log in Screen (LightDM) use same Display Properties as When Logged in

Post by mattlach »

SMG wrote:
Mon Nov 29, 2021 9:14 pm
mattlach wrote:
Sun Nov 07, 2021 3:56 pm
I hope this helps someone else.
It did. I recommended your tutorial to someone with a slightly different issue and it worked for them .
Nice! That makes spending the time on the write-up worth it!
Corsair 1000D, Threadripper 3960x, Asus ROG Zenith II, 64GB, 2TB Phison E16, AMD Radeon 6900XT, 43" Asus XG438Q, 2x Dell 2007FP, Schiit Bifrost Multibit DAC
Server: 2x E5-2650v2 (16C/32T), SuperMicro X9DRI-F, 256GB RAM, 120TB ZFS
Mosfetwall
Level 1
Level 1
Posts: 4
Joined: Fri Sep 27, 2019 5:27 pm

Re: [TUTORIAL] Make Log in Screen (LightDM) use same Display Properties as When Logged in

Post by Mosfetwall »

@mattlach Thanks mate !

The login orientation of my second monitor was driving me insane :).
mattlach
Level 4
Level 4
Posts: 291
Joined: Mon May 30, 2011 8:34 pm

Re: [TUTORIAL] Make Log in Screen (LightDM) use same Display Properties as When Logged in

Post by mattlach »

To update this a little.

I just upgraded from 20.2 to 20.3. IN doing so, the installer seems to have overwritten the slick greeter config file:

/usr/share/lightdm/lightdm.conf.d/90-slick-greeter.conf

Everything else seems to have been untouched, so after upgrading, if you just repeat the last step (adding the line to 90-slick-greeter.conf) everything should work again.
Corsair 1000D, Threadripper 3960x, Asus ROG Zenith II, 64GB, 2TB Phison E16, AMD Radeon 6900XT, 43" Asus XG438Q, 2x Dell 2007FP, Schiit Bifrost Multibit DAC
Server: 2x E5-2650v2 (16C/32T), SuperMicro X9DRI-F, 256GB RAM, 120TB ZFS
User avatar
AndyMH
Level 20
Level 20
Posts: 10780
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: [TUTORIAL] Make Log in Screen (LightDM) use same Display Properties as When Logged in

Post by AndyMH »

I do similar things - set display resolution on boot with xrandr. But:

In /etc/lightdm/lightdm.conf.d, I have a file 70-linuxmint.conf. Create a new file 71-linuxmint.conf, i.e. a higher number.

Content of 71-linuxmint.conf is:

Code: Select all

[SeatDefaults]
user-session=cinnamon
display-setup-script=/usr/bin/LGmonitor.bsh
It is pointing at a setup script to set the resolution on my monitor.

It does not get overwritten on an update.
the installer seems to have overwritten the slick greeter config file:
If you had created a /usr/share/lightdm/lightdm.conf.d/91-slick-greeter.conf it would not have been overwritten.

Code: Select all

xrandr --output DisplayPort-0 --primary --mode 3840x2160 --pos 1200x0 --rotate normal --output DisplayPort-1 --mode 1600x1200 --pos 0x560 --rotate left --output DisplayPort-2 --off --output HDMI-A-0 --mode 1600x1200 --pos 5040x560 --rotate right
It would be a wise move to wrap this statement in some if statements checking that the monitors are configured as the line expects. You could end up with a system with no graphical display if one or more of the ports are not connected. I know, I've made this mistake.
Homebrew i5-8400+GTX1080 Cinnamon 19.0, 4 x Thinkpad T430 Cinnamon 20.1, 2 x i7-3632 , i5-3320, i5-3210, Thinkpad T60 19.0 Mate
mattlach
Level 4
Level 4
Posts: 291
Joined: Mon May 30, 2011 8:34 pm

Re: [TUTORIAL] Make Log in Screen (LightDM) use same Display Properties as When Logged in

Post by mattlach »

AndyMH wrote:
Sat Jan 08, 2022 7:43 pm
I do similar things - set display resolution on boot with xrandr. But:

In /etc/lightdm/lightdm.conf.d, I have a file 70-linuxmint.conf. Create a new file 71-linuxmint.conf, i.e. a higher number.

Content of 71-linuxmint.conf is:

Code: Select all

[SeatDefaults]
user-session=cinnamon
display-setup-script=/usr/bin/LGmonitor.bsh
It is pointing at a setup script to set the resolution on my monitor.

It does not get overwritten on an update.
the installer seems to have overwritten the slick greeter config file:
If you had created a /usr/share/lightdm/lightdm.conf.d/91-slick-greeter.conf it would not have been overwritten.

Code: Select all

xrandr --output DisplayPort-0 --primary --mode 3840x2160 --pos 1200x0 --rotate normal --output DisplayPort-1 --mode 1600x1200 --pos 0x560 --rotate left --output DisplayPort-2 --off --output HDMI-A-0 --mode 1600x1200 --pos 5040x560 --rotate right
It would be a wise move to wrap this statement in some if statements checking that the monitors are configured as the line expects. You could end up with a system with no graphical display if one or more of the ports are not connected. I know, I've made this mistake.
Good to know, thank you. I'll play around a little it with that and update the guide up top.
Corsair 1000D, Threadripper 3960x, Asus ROG Zenith II, 64GB, 2TB Phison E16, AMD Radeon 6900XT, 43" Asus XG438Q, 2x Dell 2007FP, Schiit Bifrost Multibit DAC
Server: 2x E5-2650v2 (16C/32T), SuperMicro X9DRI-F, 256GB RAM, 120TB ZFS
mattlach
Level 4
Level 4
Posts: 291
Joined: Mon May 30, 2011 8:34 pm

Re: [TUTORIAL] Make Log in Screen (LightDM) use same Display Properties as When Logged in

Post by mattlach »

Mosfetwall wrote:
Sun Dec 26, 2021 8:03 am
@mattlach Thanks mate !

The login orientation of my second monitor was driving me insane :).
I'm glad it was helpful!
Corsair 1000D, Threadripper 3960x, Asus ROG Zenith II, 64GB, 2TB Phison E16, AMD Radeon 6900XT, 43" Asus XG438Q, 2x Dell 2007FP, Schiit Bifrost Multibit DAC
Server: 2x E5-2650v2 (16C/32T), SuperMicro X9DRI-F, 256GB RAM, 120TB ZFS
User avatar
EvilSupahFly
Level 3
Level 3
Posts: 106
Joined: Sat May 24, 2014 11:10 am
Location: Mordor

Re: [TUTORIAL] Make Log in Screen (LightDM) use same Display Properties as When Logged in

Post by EvilSupahFly »

I upgraded from LM20 to LM21 and lost my login display settings. I came upon your guide after questing on Google but it didn't work. My login screens are still the wrong resolution, but everything is fine once I log in.
If I had a signature, this is where I'd stick it.
User avatar
EvilSupahFly
Level 3
Level 3
Posts: 106
Joined: Sat May 24, 2014 11:10 am
Location: Mordor

Re: [TUTORIAL] Make Log in Screen (LightDM) use same Display Properties as When Logged in

Post by EvilSupahFly »

I found a better solution:

Instead, login and set your preferred screen settings (click "Apply" if anything changed), then open a terminal and run this command:

Code: Select all

sudo cp ~/.config/monitors.xml /var/lib/lightdm/.config/monitors.xml
Login resolution should now reflect the settings of the user signed in. Some people suggest making a hard link:

Code: Select all

sudo ln ~/.config/monitors.xml /var/lib/lightdm/.config/monitors.xml
But that only works if your home folder is on the same physical drive. Since my OS is on a different physical drive from my user folder (~), I had to copy the file instead of linking it. Note as well that it must be a hard link - symbolic links will not work.
Last edited by EvilSupahFly on Wed Sep 21, 2022 1:34 pm, edited 2 times in total.
If I had a signature, this is where I'd stick it.
User avatar
SMG
Level 23
Level 23
Posts: 18901
Joined: Sun Jul 26, 2020 6:15 pm
Location: USA

Re: [TUTORIAL] Make Log in Screen (LightDM) use same Display Properties as When Logged in

Post by SMG »

EvilSupahFly wrote:
Wed Sep 21, 2022 11:05 am
I found a better solution:
What desktop environment of Linux Mint are you running and when did you last do a fresh install?

LM20 Cinnamon (and newer) versions do not have a monitors.xml file. They have a cinnamon-monitors.xml file.
Image
A woman typing on a laptop with LM20.3 Cinnamon.
User avatar
EvilSupahFly
Level 3
Level 3
Posts: 106
Joined: Sat May 24, 2014 11:10 am
Location: Mordor

Re: [TUTORIAL] Make Log in Screen (LightDM) use same Display Properties as When Logged in

Post by EvilSupahFly »

SMG wrote:
Wed Sep 21, 2022 11:10 am
EvilSupahFly wrote:
Wed Sep 21, 2022 11:05 am
I found a better solution:
What desktop environment of Linux Mint are you running and when did you last do a fresh install?

LM20 Cinnamon (and newer) versions do not have a monitors.xml file. They have a cinnamon-monitors.xml file.
I'm running LM21 but I've been upgrading-in-place since LM16. Last clean install was LM16. Naming the file cinnamon-monitors.xml would probably work too.
If I had a signature, this is where I'd stick it.
Post Reply

Return to “Tutorials”