Dual heading is quickly becoming a common way to expand one desktop onto two monitors. After all, if one monitor is great, then two must be fantastic! Setting up dual-heading monitors in Ubuntu isn't too difficult, but does come with a couple caveats. This article will cover setting up dual heading just in case you have had problems. Another thing that this article covers is how to easily enable and disable that extra monitor so that you have it only when you want it.
The first thing that many do is to visit System->Preferences->Resolution. This looks quite promising at first, because usually there are two monitors listed there, one right on top of another. The user moves the monitor, disables clone, clicks apply, and woila, nothing happens! This problem is fixable by editing /etc/X11/xorg.conf as root. Look within the file for a section that looks like:
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
EndSection
And replace it with something like:
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
SubSection "Display"
Virtual 2960 1050
EndSubSection
EndSection
At this point, many people will adjust where the monitor sits with System->Preferences->Screen Resolution, and be happy, while others will want to enable the extra monitor only when they want the extra space.
The secret trick to simplifying dual-heading is to use the xrandr tool (apt-get install xrandr). Xrandr is used to enable, disable and move monitors. With this tool, we can set up a couple aliases in ~/.bashrc to turn the extra monitor on and off at will:
alias screenoff='xrandr --output VGA --off'
alias screenon='xrandr --output VGA --right-of LVDS --auto'
With these aliases, you can run that extra monitor when you want it, and turn it off when you don't.