#!/usr/bin/perl -w
#
# Default GNOME backgrounds feature by benji
# Originally Written by Michael Moore, Nov. 2007, placed in the public domain
#
# Requieres libxml-simple-perl
# $ sudo apt-get install libxml-simple-perl
#
use strict;
use warnings;
use XML::Simple;
my $switchTime = 300; # Edit to the number of seconds between photo switches
my $xml = new XML::Simple;
my $data = $xml->XMLin("/home/".getpwuid($<)."/.gnome2/backgrounds.xml");
my @photos;
my $temp;
foreach my $key (keys (%{$data->{wallpaper}})){
$temp = $data->{wallpaper}->{$key}->{filename};
if($temp ne "(none)") {
push(@photos,$temp);
}
}
chomp(@photos);
my $photo;
while(1)
{
$photo = $photos[rand($#photos)];
`gconftool-2 --type string --set /desktop/gnome/background/picture_filename "$photo"`;
sleep($switchTime);
}
Nota: Necesitas la libreria XML-Simple. Si usas ubuntu o derivados instalala ejecutando:
$ sudo apt-get install libxml-simple-perl