Jun 10, 2011

Setting to Automatically "clone" External Monitor in Ubuntu Linux w/Nvidia graphics


Just a quick write up with a fix in response to the configuratin problem Tony Bradley(PCWorld.com) describes in his article entitled "Day 7: Lessons from the Unity Trenches"(June 7th, 2011).

Tony was having problems getting his external monitor to show up as a "clone" of the notebook monitor(with correct resolution), having the setting stay after reboot, and being able to shut the lid of the computer without breaking his configuration.

Here are the 2 steps to to configure Ubuntu GNU/Linux to allow you to a.) close the lid of your laptop and not have the action change anything, and b.) automatically "clone" the notebook display to the attached external monitor (note: these steps only need to be performed once):

1.) Set the laptop lid close option to do nothing:
Hit alt+f2 to bring up the Run Dialog box
Type or paste in the command below and click OK or hit enter to set
(Note: should all be on one line):


2.) Backup your current xorg.conf, then modify the current xorg.conf (note: gedit is a graphical text editor, starting it with gksu is like starting it as admin, this is required because it lives in system space (not user space))

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.beforenvidiaclonesetting
gksu gedit /etc/X11/xorg.conf

Now, find the section entitled 'Section "Device"' and insert the following lines (Make sure to add between 'Section "Device"' and "EndSection", see example below), save the file, then close gedit.

Option "TwinView" "1"
Option "TwinViewOrientation" "clone"

Here's is an example of what the specific section of the xorg.conf should look like:
Section "Device"
     Identifier "Default Device"
     Driver "nvidia"
     Option "NoLogo" "True"
     Option "TwinView" "1"
     Option "TwinViewOrientation" "clone"

That's it! Logout and back in with your external monitor attached and it should work as a cloned external monitor (with normal resolution setting). Next, close the lid on your computer to make sure it doesn't make anything funky happen.

Should you need to roll back from the settings, simply run this terminal command, then logout/login:
sudo cp /etc/X11/xorg.conf.beforenvidiaclonesetting /etc/X11/xorg.conf