Forum

[TUTORIAL] Make Log...
 
Notifications
Clear all

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

1 Posts
1 Users
0 Reactions
54 Views
admin
(@admin)
Member Admin
Joined: 7 years ago
Posts: 335
Topic starter   [#80]

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.



   
Quote
Share: