I have two LCDs and Ubuntu, and I want to use compositing so I can use Compiz. Xinerama still doesn't work with Composite outside of Xgl, which was deprecated some years ago. I want to play full screen games but they don't properly span monitors in many cases, even if that's what I wanted. What is needed then is a way to easily toggle the second monitor. I found it in the Ubuntu forums archive in the form of Disper.
After installing disper the following script works for me:
#!/bin/sh
#
# toggle dual monitors with disper
#
disper -lv 2>&1 | grep associating && disper -d auto -e || disper -d DFP-0 -e
Hope it works for you, too. You may need to change "DFP-0" to something else, like "CRT-0" depending on how the monitor is connected. Try disper -lv
for more ideas. I bound it to XF86Explorer using Compiz (after unbinding it since XF86Home effectively does the same thing, and I have a home key too) so now the icon on my keyboard that most looks like a monitor will toggle between the two.
Here are some additional, related, more complex solutions:
nvidia display control on the thinkpad *
Automatic screen configuration with auto-disper