. Now includes png and gif images instead of just jpg
. Now checks to see if the monitor is off. If it's off because of
screensave or powersaving there is no need to change the wallpaper
$totals{bgdirs} = 0;
for (@{$opts{bgdirs}}) {
$totals{bgdirs} = 0;
for (@{$opts{bgdirs}}) {
- my @pics = `find "$_" -type f -name "*.jpg"`;
+ my ($status, @pics) = Execute "find \"$_\" -type f";
+ push @images, grep(/jpg$|png$|gif$/i, @pics);
+
push @{$opts{bgdircnt}}, scalar @pics;
$totals{bgdirs}++;
push @{$opts{bgdircnt}}, scalar @pics;
$totals{bgdirs}++;
my $bgimage = escapeHTML ($images[int (rand $#images)]);
my $lockimage = escapeHTML ($images[int (rand $#images)]);
my $bgimage = escapeHTML ($images[int (rand $#images)]);
my $lockimage = escapeHTML ($images[int (rand $#images)]);
+ my $monitorIsOn;
+
+ my ($status, @output) = Execute("xset q | grep Monitor | awk '{print \$3}'");
+
+ next if $status or $output[0] eq 'Off';
+
my $cmd = "$setbg $setbgOpts$bgimage\" 2> /dev/null";
my $cmd = "$setbg $setbgOpts$bgimage\" 2> /dev/null";
+ ($status, @output) = Execute $cmd;
error "Trying to set background - command used \"$cmd\"\n\nOutput\n\n" .
join "\n", @output;
$totals{errors}++;
error "Trying to set background - command used \"$cmd\"\n\nOutput\n\n" .
join "\n", @output;
$totals{errors}++;
if ($opts{lockscreen}) {
$cmd = "$setbg $setLockOpts$lockimage\" 2> /dev/null";
if ($opts{lockscreen}) {
$cmd = "$setbg $setLockOpts$lockimage\" 2> /dev/null";
+ ($status, @output) = Execute $cmd;
error "Trying to set lock screen - command used \"$cmd\"\n\nOutput\n\n" .
join "\n", @output;
$totals{errors}++;
error "Trying to set lock screen - command used \"$cmd\"\n\nOutput\n\n" .
join "\n", @output;
$totals{errors}++;