~ubuntu-x-swat/xorg-server/xsmoke

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/perl
use strict;

my @xrandr = `xrandr`;

my $cur_output;
foreach my $line (@xrandr) {
    chomp $line;
    if ($line =~ /^\s+(.*)$/) {
        my @rates = split /\s+/, $1;
        my $res = $rates[0];
        shift @rates;
        if ($cur_output) {
            printf("%s:%s=%s\n", $cur_output, $res, join(',', @rates));
        }
    } elsif ($line =~ /^([^\s]+)\s+connected/) {
        $cur_output = $1;
    }
}