Ever since I switching from a IBM Thinkpad T40 with a screen resolution of 1024×768, to a Lenovo Thinkpad T61 with a 1440×900 screen and NVidia graphics card, I’ve had problems with external projectors. Whether I’ve booted up the default OS, Ubuntu 8.04, or Windows XP, the projector usually shows a squashed wide-screen image or just part of an image. The laptop’s 16:9 screen just seemed terminally incompatible with every 4:3 projector out there.
But recently I stumbled upon a simple solution that so far has worked with every projector and external screen I’ve connected to the VGA port. Here it is, in three steps:

  1. If it isn’t already on, boot up you computer and log in.
  2. Connect the cable to the projector/external screen. That’s right: wait until you are logged in, do not connect the cable before you boot up.
  3. Restart X server, and log in again. To restart X in Ubuntu, just press Ctrl-Alt-Backspace.

By restarting X you will shut down Firefox, Openoffice and other applications that depend on the graphical subsystem. But most of Linux will be untouched, which means that the process should just take a few seconds. Anyway, in my experience it is far more predictable than running the projector application that launches in Windows XP when you press Fn-F5, and faster than using the NVidia application.
There might be a zeroth step here: My T61 is normally connected to an external 1680×1050 monitor, via the VGA port on a docking station. This meant that I initially had to use the NVidia X server Preferences application (normally found in System/Administration/NVidia X Server Settings or started by typing sudo nvidia-settings in a terminal window) to create a dual screen setup.
If you run this while an external monitor or projector is connected, you will see it listed along with the laptop screen when you press X Server Display Configuration. In the menu under the screen layout window, press “Configure” and choose “Separate X screen”, set the resolution to Auto and save the X Configuration file. With this setup as you standard xorg.conf file, the NVidia card seems to detect any new screens and change the resolution accordingly when you restart X.