X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=bin%2Fsetbg;h=39ce45bf53eb5506c22ed33ebf1984a433595485;hb=78865a3b920fa9681f16285ae96f2ffe9af0d12f;hp=3f9aa8204c00b511598489d13418e0c73d9e91d9;hpb=4ac0e0822cd34335450077d385a84f0fa398cf52;p=clearscm.git diff --git a/bin/setbg b/bin/setbg index 3f9aa82..39ce45b 100755 --- a/bin/setbg +++ b/bin/setbg @@ -57,6 +57,7 @@ use warnings; use FindBin; use Getopt::Long; use Proc::ProcessTable; +use CGI qw/:standard/; use lib "$FindBin::Bin/../lib"; @@ -97,7 +98,7 @@ foreach (@imgDir) { } # foreach # Using gsettings -my $setbg = "gsettings"; +my $setbg = "gsettings"; my $setbgOpts = "set org.gnome.desktop.background picture-uri \"file://"; my @images; @@ -123,7 +124,7 @@ my $debugger = $DB::OUT; EnterDaemonMode unless defined $DB::OUT; while () { - my $image = $images[int (rand $#images)]; + my $image = escapeHTML ($images[int (rand $#images)]); open my $log, '>', "$ENV{HOME}/.$FindBin::Script" or error "Unable to open $ENV{HOME}/.setbg for writing - $!", 1; @@ -132,8 +133,14 @@ while () { my $cmd = "$setbg $setbgOpts$image\" 2> /dev/null"; - `$cmd`; + my @output = `$cmd`; + if ($? != 0) { + display "ERROR Trying to set background - command used \"$cmd\"", $log; + display "Output:"; + display join "\n", @output, $log; + } # if + close $log; sleep $sleep;