First, thank you so much wvengen for writing disper. It has made my struggle with nvidia-settings and xorg.conf go away overnight.
For everyone who has been asking for a --toggle feature, I'd like to offer the small Perl script below that I hacked out this evening. Ugly? You bet. But perhaps it will help until something more serious is added to disper.
# Args that are always needed
my $disperArgs = '--scaling native ';
# Use nvidia-settings to get the TwinView status
my ($twinViewStatus) = `nvidia-settings --query TwinView` =~
/Attribute 'TwinView' \(.*\): (\d)\./;
# Configure args for disper
$disperArgs .= $twinViewStatus
# TwinView is on (1), we need to switch to single
# TwinView is off (0), we need to extend
# Perform the switch
system "disper $disperArgs";
If this script is hard to read here or is mangled for you, it's also available at http://ui3.info/darcs/scripts/disper-toggle
I plan to hook this bad-boy up to my laptop monitor toggle Fn key.
Thanks again, wvengen. Great work. Much appreciated.