There’s a lot of stuff on the web about how to setup your nvidia card with ubuntu. After a lot of work, I am able to switch between single and dual monitor setup with an nVidia Quadro 1000M video card on my Lenovo Thinkpad w520 running Ubuntu 11.10. The following is an instruction list that worked for me.

• BIOS: set to discrete and disable optimus detection

• Backup:

• OPTIONAL? I did this, but not sure if any of it is necessary
• Run “sudo nvidia-xconfig” to replace the current xorg.conf file. Alternatively, you could use my config file, available here

• Edit /etc/X11/xorg.conf and add the following to “Device” section

* Where the BusId bit is determined by the output of:

• Add the following to /etc/modprobe.d/blacklist.conf
• Reboot, and if everything works, I highly recommend saving the xorg.conf file somewhere (like in a git repo)

Notes:

• If you want dual monitors, I HIGHLY recommend disper.
• If disper doesnt work (it will), you could do it the uglier way: run “nvidia-settings” and click the “detect monitors” button. Click “apply.” (Don’t “save” the settings because you’ll probably overwrite the xorg.conf file that has your customizations in it.)

• If you get a black screen on reboot and want to try hacking around, don’t forget about these:
• Hitting <CTRL><ALT><F1> to login to a terminal without X
• Checkout man pages for xrandr, startx and X (though these may not work properly with the nvidia drivers)
• If your hosed and want to undo everything, change the BIOS back to its original settings (probably Integrated Graphics) and replace (or remove) the xorg.conf file