I have an external monitor which I use to extend my laptop screen. Each time I log in, I have to start up the Nvidia settings dialog and set up the external monitor.

I would like to have that done automatically. There is an option "Save to configuration file", which keeps this setting saved. Only if I happen to start up my laptop without the external monitor attached, I get only half the display. Without any panels, it's a bit of a hassle to start Nvidia settings again and re-adjust.

Is there any way to have it detect at start up if the monitor is attached or not, and adjust the display accordingly?

P.S. I'm on Ubuntu 11.10.