try this:
http://willem.engen.nl/projects/disper/use whatever method you like to set up some desired display configuration (e.g. set up 2 external displays with extended desktop; i used the nvidia admin panel to achieve this). then use disper to export the configuration settings:
$ disper --export > external_dual_display.metamode
set up another display configuration (e.g. only the laptop panel) and again, export it with disper
$ disper --export > laptop_panel.metamode
then you can recall display configurations:
$ disper --import < external_dual_display.metamode
$ disper --import < laptop_panel.metamode
you can assign global keyboard shortcuts to both commands, e.g. Meta-F1 and Meta-F2
you can also recall the dual display command from Startup Applications; if no external displays are found on boot, it will silently fail
=================================================
for reference, here is what i'm using for my notebook (*.metamode files are exported by disper):
$ cat /home/dual_display.metamode
backend: nvidia
associated displays: CRT-0, DFP-0, DFP-1
metamode: CRT-0: 1280x1024 @1280x1024 +1280+0, DFP-1: nvidia-auto-select @1280x1024 +0+0
scaling: default, default, stretched
xinerama info order: DFP-1, CRT-0, DFP-0
$ cat /home/single_desktop_display.metamode
backend: nvidia
associated displays: DFP-1
metamode: DFP-1: nvidia-auto-select @1280x1024 +0+0
scaling: stretched
xinerama info order: DFP-1
$ cat /home/single_display.metamode
backend: nvidia
associated displays: DFP-0
metamode: DFP-0: nvidia-auto-select @1366x768 +0+0
scaling: stretched
xinerama info order: DFP-0
$ cat /home/dual_display
/usr/bin/disper -i < /home/dual_display.metamode
$ cat /home/single_desktop_display
/usr/bin/disper -i < /home/single_desktop_display.metamode
$ cat /home/single_display
/usr/bin/disper -i < /home/single_display.metamode