5

Laptop: Lenovo T530

enter image description here

External VGA monitor: LG Flatron E2051

enter image description here

The LG monitor is set as primary. The login screen shows on both the laptop monitor and the external monitor. The resolution of the laptop monitor is correct, but the resolution on the LG monitor is the same as the laptop monitor, instead of the correct resolution as shown above.

If I login, the resolution on the LG monitor switches to the correct resolution.

If I lock the screen, the resolution of the LG monitor drops down to the incorrect resolution and corrects itself when I log in again.

I tried to take a screenshot of the login screen, but all I ended up with was a black image.

How do I fix this problem, so that the login screen is the correct resolution on both monitors at bootup and when the screen is locked?

Thank you.

5

xrandr allows us to reconfigure the X server without restarting it. Let's use it to set the correct resolution at startup.

Find out how the monitors are identified on your system. At the terminal, run the following:

xrandr -q | grep ' connected ' | awk '{ print $1 }'

My output is:

LVDS1
VGA1

Now I want to narrow down the above results to only the LG monitor, so that I can assign that to a variable:

xrandr -q | grep 'VGA1 connected' | awk '{ print $1 }'

The output is now:

VGA1

Lets create a script that checks to see if the LG monitor is connected. If it is connected, let's switch off the laptop monitor, set the LG monitor to primary and set it to the correct resolution. The laptop monitor will automatically switch back on after a successful login.

Create the bash script:

sudo vim /usr/local/bin/correct-screen-resolution-pantheon-greeter

Script contents:

#!/bin/bash

LG="$(xrandr -q | grep 'VGA1 connected' | awk '{ print $1 }')"
if [ "$LG" = "VGA1" ]; then
  xrandr --output LVDS1 --off
  xrandr --output VGA1 --primary --mode 1600x900
fi

We need to make the script executable:

sudo chmod +x /usr/local/bin/correct-screen-resolution-pantheon-greeter

Now, we need to call the script from pantheon-greeter:

sudo vim /usr/share/lightdm/lightdm.conf.d/40-pantheon-greeter.conf

At the bottom of the file, add the following line:

greeter-setup-script=/usr/local/bin/correct-screen-resolution-pantheon-greeter

Done.

Example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.