Setting to Automatically Extend Your Screen onto External Monitor in Ubuntu Linux w/Nvidia graphics

Setting to Automatically "Extend" Your Screen onto External Monitor in Ubuntu Linux w/Nvidia graphics

Just a quick write up with a fix for those who are having problems saving their "extended" monitor configurations when using their notebooks with and without the docking station.

For a long time I would use the nvidia-settings utility to manually set up my external monitor after docking. This required several clicks of the mouse. Now I've found a way to make a minor edit to my /etc/X11/xorg.conf file that will keep the "extended" setting when docked and revert to the single screen without issue when not.

Here are the 2 steps to to configure Ubuntu GNU/Linux to allow you to a.) automatically "Extend"your display onto the external monitor, set the external monitor as "primary"(configurable), set the external monitor to be to the right of the built-in one(configurable), and autoselect the best resolution for the monitors as necessary. Note: these steps only need to be performed once:

1.) 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

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

#Enables the "extended desktop" setting
Option "TwinView" "1"
#Set which screen gets to be primary with TwinViewXineramaInfoOrder
Option "TwinViewXineramaInfoOrder" "DFP-0"
#Set the position of each monitor
Option "TwinViewOrientation" "CRT-0 RightOf DFP-0"
#Autoselect the best resolution for the monitors
Option "MetaModes" "CRT: nvidia-auto-select, DFP: nvidia-auto-select"

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 "TwinViewXineramaInfoOrder" "DFP-0"
     Option "TwinViewOrientation" "CRT-0 RightOf DFP-0"
     Option "MetaModes" "CRT: nvidia-auto-select, DFP: nvidia-auto-select"
EndSection

That's it! Logout and back in with your external monitor attached and it should work as an "exteneded" external monitor (with normal resolution settings and primary being the attached monitor).

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


Popular posts from this blog

How To Connect Ubuntu Linux to Cisco VPN with openconnect (anyconnect-capable alternative)

How To Set Default Grub / kernel / boot option on Ubuntu GNU/Linux 14.04

How To: Fix Samsung Galaxy Nexus MTP File Transfer for Ubuntu GNU/Linux 11.10