5 my $FVWM = (defined $ENV{FVWM_USERDIR}) ? $ENV{FVWM_USERDIR}
8 die ("usage: randombg.pl <directory>") if (! -d $ARGV[0]);
10 open XASPECT, "-|", "$FVWM/scripts/C/xaspect", "-dimensions";
11 my $aspect = <XASPECT>;
13 die ("Incompetent use of xaspect") if ($?);
15 $aspect =~ s/(^\s*)|(\s*$)//g;
17 opendir WALLPAPER, $ARGV[0];
18 my @dir = grep(/\Q$aspect\E\.png$/, readdir WALLPAPER);
21 print $ARGV[0] . "/" . $dir[int(rand(@dir))] . "\n";