I solved using disper. Type in a terminal:
sudo apt-get install disper
After solving the issue with the method proposed by Paŭlo Ebermann or nvidia-settings or whatever works for you, type in a terminal:
disper --export < /path-to-my-file/my-disper-file.metamode
my-file.metamode is as follows:
associated displays: DFP-0, DFP-1
metamode: DFP-0: 1366x768 @1366x768 +1920+312, DFP-1: 1920x1080 @1920x1080 +0+0
scaling: stretched, stretched
xinerama info order: DFP-1, DFP-0
The third row takes into account the particular positioning of two screens with different heights. Your case may be simpler. You could try to create the file that fits your configuration (without using other methods + disper --export).
The important point is the order of the screens in the second and in the last rows.
You can use the script and making it run at startup:
#Auto switch single/extend display with disper on Multiple Monitor.
lines=$(disper -l | wc -l)
display_count=$((lines / 2))
if [ $display_count -eq "1" ]; then
disper --import < /path-to-my-file/my-disper-file.metamode
It worked with my nvidia graphics card (both precise and quantal).
Hope it helps.