Wrong Login Screen Resolution
On the odd occasion, usually after incorrectly restarting my computer, my login screen resolution is not the default 1440x900, but I think 1600x900. Now, I have this monitor that's really bad at handling resolutions it's not designed to handle, and will show a silly "wrong resolution" box jumping around the screen.
Is there any way to make the login screen load a 1440x900 resolution no matter what? I'm running Ubuntu 11.10 with Unity and LightDM.
Solution 1:
You can make a script for this (source LightDM Resolution).
- Firstly we need to find out what your monitors identifier is. Open up a terminal, start typing
terminal
in your unity dash to see the option or press Ctrl+Alt+T -
Type/copy this command to show your display details:
xrandr -q
If you only have one monitor you will see a line in the output like the following (probably with some different values, its the identifier at the start we are after):
DVI-0 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 473mm x 296mm
The screen identifier is DVI-0 in this case
Open up your favourite text editor, lets use gedit for this example, press Alt+F2 and type
gedit
-
Type/copy this in:
#!/bin/sh xrandr --output DVI-0 --primary --mode 1440x900
Save this on your desktop as
lightdmxrandr.sh
-
You may want to test the script before we put it into practice. Back in the terminal navigate to where we just saved it:
cd ~/Desktop
Now we need to make it executable:
chmod a+rx lightdmxrandr.sh
Now run it:
./lightdmxrandr.sh
(If your screen automatically auto-corrects after log in you probably won't see a difference so you may want to use a test resolution that is different but you know works while testing)
-
Now lets move the little script we made:
sudo mv ~/Desktop/lightdmxrandr.sh /usr/share/.
If you don't use
sudo
you may get a permission error (I use this folder out of personal preference) -
We need to now run this in lightdm, navigate to the correct folder:
cd /etc/lightdm
-
Open up the lightdm conf file:
sudo gedit lightdm.conf
-
Now add the the instruction to run your script after the last line and save:
display-setup-script=/usr/share/lightdmxrandr.sh
Now reboot and that should set the correct resolution on your lightdm log in screen.
(these instructions might look long but they don't take long at all)
Solution 2:
I found a very simple workaround that works perfectly for me running 13.04. (update: now 13.10) on a laptop with a 24" external screen that is not permanently connected.
I'll just copy from here
- log in
- use xrandr or the Displays control utility to configure your monitors how you'd like them to be configured in the login screen
- copy ~/.config/monitors.xml to /var/lib/lightdm/.config
Since I already had my monitors configured properly I just had to do step 3.
Some other answers given here worked for me but only in a specific scenario while running risk of an unusable system in other scenarios (LOW GRAPHICS MODE ERROR). For example with the external monitor permanently connected (accepted answer by @captain_G) or with always the same device connected to the output used for the external monitor (script by @Axlrod). It seems that @MarcoV's answer is the most generic solution, however it does still involve scripting rules.
Solution 3:
You can instead of creating script, just add to file /etc/lightdm/lightdm.conf
a line like this:
display-setup-script=xrandr --output default --mode 1280x720
Before inserting make sure that command works, because with wrong command, lightdm will not start.
Solution 4:
sudo gedit /usr/share/X11/xorg.conf.d/52-myres.conf
then in the file:
Section "Monitor"
Identifier "VGA1"
Option "PreferredMode" "1152x864"
EndSection
Save and exit. The values were obtained from command xrandr -q
. VGA1
is the name of my connector and 1152x864
is the name of the resolution.
This works for Xubuntu 16.04. It sets a preferred resolution and for me it let me set the resolution of the login screen, instead of having it default to the highest resolution supported.
Modified from answers here
Solution 5:
For a multi monitor setup where you might disconnect your laptop and use without, here is a simple solution:
run:
xrandr
Get the devices you are using laptop is usually LVDS1, and for me I have a DP2 (displayport 2) it could be HDMI1 or anything else, just find the ones with resolutions listed next to them.
Create this small bash file:
#!/bin/bash
mode="$(xrandr -q|grep -A1 "DP2 connected"| tail -1 |awk '{ print $1 }')"
if [ -n "$mode" ]; then
xrandr --output LVDS1 --off
xrandr --output DP2 --primary --mode 2540x1440
fi
Replace LVDS1 with your laptop monitor connection.
Replace DP2 with your external monitor connection.
Place bash script in /usr/bin/local/
chmod +x the script
edit /etc/lightdm/lightdm.conf
Add
display-setup-script=/path/to/my/script
Reboot.
The resolution change will only happen when you are actually at that display now.
If you have multiple places with different monitors / resolutions on same connector you will have to put more intelligence in your bash script.