cycle.pl:
#!/usr/bin/perl $path = "/usr/X11R6/share/bgrotate"; open FIL,"$path/current"; $current = <FIL>; close FIL; open FIL,"$path/cycle"; $dat = <FIL>; $first = $dat; while ($dat ne $current) { $dat = <FIL>; } unless ($next = <FIL>) {$next = $first;}; close(FIL); $res = system "Esetroot -f $path/$next"; if ($res != 0) { print "could not set bg\n"; exit 1;} open FIL,">$path/current"; print FIL $next; close FIL;
rotate.pl:
#!/usr/bin/perl $path = "/usr/X11R6/share/bgrotate"; while (1==1) { $res = system "$path/cycle.pl"; if ($res !=0) {exit 1;} sleep 600; }
Filen “current” skal programmet have skriveadgang til og indeholder navnet paa nuvaerende baggrund. og cycle indeholder listen over de baggrundsbilleder der cycles imellem.