First you have to configure your dual monitor setup properly with the nvidia drivers. (You can do this with the nvidia-settings)
Now...
- Open the nvidia-settings and configure your monitors, putting one of them as disabled. (Here I have to go to the "X Server Display Configuration" and after selecting one monitor in "configuration" choose "Disabled")
- Press the "Save to X Configuration File" (Don't worry, we will not do anything)
- Press the "Show preview..." button
- In the new windows, at the section "screen" (in my file it is the last section) copy what appears after the 'Option "metamodes"'
- Cancel and close nvidia-settings
Now to the file edition part...
- Assure first that you have the package "x11-xserver-utils" installed (we will use the xrandr command)
- Open as super-user the file "/etc/X11/xorg.conf"
- At the "screen" section add one more option in the "metamodes":
- At the end of the string (before the quotes) add a semicolon
- Paste what you have copied from the nvidia-settings preview
To clarify...In my xorg.conf:
The metamodes, in my machine, before the modifications was:
Option "metamodes" "CRT: nvidia-auto-select +1920+56, DFP: nvidia-auto-select +0+0"
Then, after the modification:
After that you can create a bash script to turn on and off the monitor you chose.Option "metamodes" "CRT: nvidia-auto-select +1920+56, DFP: nvidia-auto-select +0+0;CRT: null, DFP: nvidia-auto-select +0+0"
To turn the monitor off:
To turn the monitor on:#!/bin/bash xrandr -s 1
The scripts (and the single commands, of course) will only work after you restart your X, usually by restarting your machine.#!/bin/bash xrandr -s 0
You can play with your monitor configuration, xrandr and xorg.conf (with due care) to turn off the other monitor or to fit it in your n-headed computer need :)
That's all folks!
I used the great help of this site:
http://morgancollett.wordpress.com/2008/11/25/nvidia-twinview-and-xrandr/