I am affected by the BUG: https://bugs.launchpad.net/ubuntu/+source/unity-greeter/+bug/874241 Otherwise, if like me you have a laptop connected to a second monitor of higher resolution, LIGHTDM at the login stage, mirrors the displays in both screens and assign to them a common resolution (1024X768) in my case, instead of extending the desktop (Primary screen with the greeter and secondary with just a logo as mentioned in the Multiple Monitors UX specifications book for 12.04).
Here is my xrandr -q
@L502X:~$ xrandr -q
Screen 0: minimum 320 x 200, current 1920 x 1848, maximum 8192 x 8192
LVDS1 connected 1366x768+309+1080 (normal left inverted right x axis y axis) 344mm x 193mm
1366x768 60.0*+
1360x768 59.8 60.0
1024x768 60.0
800x600 60.3 56.2
640x480 59.9
VGA1 disconnected (normal left inverted right x axis y axis)
HDMI1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 510mm x 287mm
1920x1080 60.0*+
1600x1200 60.0
1680x1050 60.0
1280x1024 60.0
1440x900 59.9
1280x960 60.0
1280x800 59.8
1024x768 60.0
800x600 60.3 56.2
640x480 60.0
DP1 disconnected (normal left inverted right x axis y axis)
I tried to force lightdm to execute some xrandr commands in order to set the right resolution for each monitor and extend the desktop, so I created a simple script named /usr/share/lightdmxrand.sh:
#!/bin/sh
xrandr --output HDMI1 --primary --mode 1920x1080 --output LVDS1 --mode 1366x768 --below HDMI1
And told lightdm to run it : /etc/lightdm/lightdm.conf
[SeatDefaults]
greeter-session=unity-greeter
user-session=ubuntu
greeter-setup-script=/usr/bin/numlockx on
display-setup-script=/usr/share/lightdmxrandr.sh
restarted lightdm : sudo restart lightdm
And the unity greeter login screen was correct. Screens with their respective correct resolutions and if I move the mouse to a screen, it gets focus with the login box and panel, while the unfocused screen just displays an Ubuntu Logo (Just as specified in the MM UX spec book). Fantastic!
This workaround works great as long as The external monitor is connected to the laptop.
In the situation where it is not connected, at the login stage, I get :a LOW GRAPHICS MODE ERROR (You're running in low graphics mode, your screen, input devices...did not get detected..). Normal, because xrandr
tries to output to a non connected monitor.
The question here is how should I modify the script in a way that when the external monitor is not connected xrandr
outputs only to the laptop screen and ignores any external monitor.
E.G:
If (xrandr -q | grep 'HDMI1 connected') != NULL (HDMI1 is connected )
then xrandr --output HDMI1 --primary --mode 1920x1080 --output LVDS1 --mode 1366x768 --below HDMI1
else xrandr --output LVDS1 --mode 1366x768 (or do nothing - because the resolution of the laptop screen is correct when no external monitor is connected)
Thanks in advance.
NOTE: I also posted this answer here
I found a very simple workaround that works perfectly for me running 13.04. on a laptop with a 24" external screen that is not permanently connected.
I'll just copy from here
Since I already had my monitors configured properly I just had to do step 3.
I managed this little basic script below that answers my question. Now, whether the external monitor is connected or not, Lightdm uses the right resolutions at the greeter stage. Nevertheless, this same script needs to be modified to be generic, in a way that the user wouldn't need to specify manually resolutions of its laptop and monitor screens.
So if someone has a better solution or a more generic script, he's the man.
SCRIPT:
Many thanks Hanynowsky! Finding your answer saved me a ton of work (recently upgraded 12.04). However in my case it didn't provide the complete solution so I would like to add what I learned. My setup was a Samsung S22A300B plugged into the VGA port of a Vaio VGN-CR120E with built-in 1280x800 display and a Mobile GM965/GL960 Integrated Graphics Controller.
Briefly what I found was:
To workaround this limited maximum resolution I did the following:
This ALMOST worked, but after logon the external monitor was reset from a nice 1920x1080 back to 1024x768. It turned out that this was a persistent user setting and was easily fixed by using the Displays... System Setting (from the gear menu) to the now available 1920x1080. Now when I boot with the external monitor connected everything works as expected.
One additional glitch: If this script gets run twice (for example from terminal) the xrandr --newmode line will get a "BadName (named color or font does not exist)" error, but https://stackoverflow.com/questions/851704/xrandr-errors-badname-named-color-or-font-does-not-exist explained this and it seems benign. Also shouldn't be a problem when the script is hooked up lightdm.conf per Hanynowsky's instructions vs. run manually.
I'm providing the changes adapted for the above (VGA with no EDID functionality) in the hopes it will help someone else. As mentioned in the preceding answers you will have to adapt this for your own setup. I don't have any good advice on obtaining the correct modline, but if someone else does please chip in.
NOTE: I'm not sure if the eval is necessary (vs. echo in the original). I put this in before I discovered that my Displays... settings were resetting the external display to a lower resolution.
I found that instead of using --mode to explicitly state the resolution, --auto will choose the best resolution for you(the largest one I believe).
If you're using LightDM's GTK greeter then you can run
xrandr -q
to find the names of your monitors then edit/etc/lightdm/lightdm-gtk-greeter
and set the propertyactive-monitor
as described in the comments inside that file. This property can take multiple, ordered values including#cursor
for the monitor that currently shows the mouse cursor.