I have a HP laptop with an nVidia card, and I'm using Ubuntu 11.04 (stable). I have set up TwinView using the nVidia X Server Settings application. If I boot up without my secondary monitor plugged in, the desktop is stretched and out of resolution. Unity and the main panel work and look normal, but any applications I run are also stretched and the resolution is wrong, making them virtually unusable. When I boot with my secondary monitor plugged in (via HDMI) everything is working fine.
I've drilled this down to my xorg.conf file. If I delete the file and restart, the primary monitor works fine but I need to configure nVidia to use TwinView again. For a laptop where I'm constantly switching between single and multiple monitors, this gets annoying...
So basically my question is: can I set up Ubuntu in a way where the dual monitor settings are ignored when only 1 monitor is plugged in? This worked fine in 10.10 (btw I still have that xorg.conf file, and it causes the same issue).
Here is my current xorg.conf file:
# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings: version 270.29 (buildd@allspice) Fri Feb 25 14:42:07 UTC 2011
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
Option "Xinerama" "0"
EndSection
Section "Files"
EndSection
Section "InputDevice"
# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
# generated from default
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "Monitor"
# HorizSync source: edid, VertRefresh source: edid
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Seiko/Epson"
HorizSync 30.0 - 75.0
VertRefresh 60.0
Option "DPMS"
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "GeForce GT 230M"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "TwinView" "1"
Option "metamodes" "DFP-0: nvidia-auto-select +1920+0, DFP-1: nvidia-auto-select +0+0"
SubSection "Display"
Depth 24
EndSubSection
EndSection