View Single Post
Old 07-06-09, 11:53 PM   #21
Registered User
Join Date: Jun 2007
Posts: 2
Default thanks! plus: toggle wrapper script

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.

#! /usr/bin/perl

use strict;
use warnings;

# 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
? '--single'
# TwinView is off (0), we need to extend
: '--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

I plan to hook this bad-boy up to my laptop monitor toggle Fn key.

Thanks again, wvengen. Great work. Much appreciated.

Last edited by dino; 07-07-09 at 12:21 AM. Reason: code may be mangled by the forum software
dino is offline   Reply With Quote