rotated monitor. login screen needs rotation

Add this line to the /etc/lightdm/lightdm.conf file (in the [SeatDefaults] section):

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

Then make the file /etc/lightdm/greeter_setup.sh with the following contents:

#!/bin/bash
xrandr -o left
exit 0

Then make it executable with sudo chmod +x /etc/lightdm/greeter_setup.sh. Then reboot.


Another option that should work is to copy ~/.config/monitors.xml to /var/lib/lightdm/.config .

This certainly works for my monitor position and resolution information, so I would assume it would work for rotation too.

Edit: For maximum flexibility, one could make a symbolic link between the above:

sudo su
cd /var/lib/lightdm/.config
ln -s /home/<your_user>/.config/monitors.xml .
chown -h lightdm:lightdm monitors.xml
exit

This way, if your monitor setup changes in the future, it will automatically reflected to the login screen. Notice the necessary -h flag on the chown command, as explained in chown is not changing symbolic link.


14.04 and above

Falconer's answer helped me very much, but lightdm changed for Ubuntu Trusty 14.04. There is no longer a /etc/lightdm/lightdm.conf file on my system. lightdm has now gone the "Debian way" and had its configuration broken up into a conf.d directory. You now need to create the following file:

/etc/lightdm/lightdm.conf.d/80-display-setup.conf

[SeatDefaults]
display-setup-script=xrandr -o right

As suggested in Electric Head's answer, the xrandr command can go right in this file, no need to create a separate script.

If you want a xrandr command that deals with multiple monitors, you can use arandr to generate it for you. My xrandr command actually ends up being:

xrandr --output DVI-1 --mode 1920x1080 --pos 1080x0 --rotate left --output DVI-0 --mode 1920x1080 --pos 0x0 --rotate right

To get that I used the following commands:

  • sudo apt-get install arandr
  • arandr
  • Use the GUI to configure your monitors like you want them:

    arandr
  • Use "Layout" -> "Save As" to save it to a file that contains your monitor configuration command.

With this in place, my monitors are properly rotated when I log in as well, so there is no need to do additional configuration in Gnome, XFCE, or KDE. The only other place that I need to configure monitor rotation is in virtual framebuffer terminals, as explained in How do I rotate my display when not using an X Server?