pictures contained in -bgdir(s). This allows us to update the array in
case there have been pictures added.
Setbg also will respond to USR1 signal and recompute the images array.
use lib "$FindBin::Bin/../lib";
use lib "$FindBin::Bin/../lib";
($VERSION) = ($VERSION =~ /\$Revision: (.*) /);
my $processes = new Proc::ProcessTable;
($VERSION) = ($VERSION =~ /\$Revision: (.*) /);
my $processes = new Proc::ProcessTable;
foreach my $process (@{$processes->table}) {
if ($process->cmndline =~ /setbg/ and
foreach my $process (@{$processes->table}) {
if ($process->cmndline =~ /setbg/ and
+sub fillPictures () {
+ my @images;
+
+ foreach (@imgDirs) {
+ my @pics = `find "$_" -type f -name "*.jpg"`;
+
+ chomp @pics;
+ push @images, @pics;
+ } # foreach
+
+ return @images;
+} # fillPictures
+
$0 = "$FindBin::Script " . join ' ', @ARGV;
verbose "$FindBin::Script v$VERSION";
my $sleep = 60 * 60;
$0 = "$FindBin::Script " . join ' ', @ARGV;
verbose "$FindBin::Script v$VERSION";
my $sleep = 60 * 60;
GetOptions (
'usage' => sub { Usage },
'verbose' => sub { set_verbose },
'debug' => sub { set_debug },
'sleep=i' => \$sleep,
GetOptions (
'usage' => sub { Usage },
'verbose' => sub { set_verbose },
'debug' => sub { set_debug },
'sleep=i' => \$sleep,
+ 'bgdir=s' => \@imgDirs,
error "$_ is not a directory", 1 unless -d $_;
} # foreach
error "$_ is not a directory", 1 unless -d $_;
} # foreach
my $setbg = "gsettings";
my $setbgOpts = "set org.gnome.desktop.background picture-uri \"file://";
my $setbg = "gsettings";
my $setbgOpts = "set org.gnome.desktop.background picture-uri \"file://";
-my @images;
-
-foreach (@imgDir) {
- my @pics = `find "$_" -type f -name "*.jpg"`;
- chomp @pics;
- push @images, @pics;
-} # foreach
+my @images = fillPictures;
Usage "No images to display. Must specify -imgDir" unless @images;
Usage "No images to display. Must specify -imgDir" unless @images;
} # SwitchWallPaper
$SIG{USR2} = \&SwitchWallPaper;
} # SwitchWallPaper
$SIG{USR2} = \&SwitchWallPaper;
+$SIG{USR1} = \&fillPictures;
EnterDaemonMode unless defined $DB::OUT;
EnterDaemonMode unless defined $DB::OUT;
+
+ if ($today ne YMD){
+ @images = fillPictures;
+ } # if