ZConf::BGSet - A perl module for background management.
Version 1.0.0
use ZConf::BGSet; my $zbg = ZConf::BGSet->new(); ...
This initializes it.
One arguement is taken and that is a hash value.
If this it fails, $zbg->{perror} is set and the other methods will always error as a permanent error has been set.
If this key is defined, this hash will be passed to ZConf->new().
my $zbg=ZConf::Runner->new(); if($zbg->{error}){ print "Error!\n"; }
This adds an item to the history.
This specifies the hostname to use. If this is not defined, the hostname of the machine it is currently running on will be used.
This is the X display the BG was set on. If it is not set, the enviromental variable 'DISPLAY' is used.
This is the fill type that was used.
This is the image the background was set to.
$zbg->addToLast({image=>'/tmp/something.jpg', filltype=>'full'}); if($zbg->{error}){ print "Error!\n"; }
This creates a path. If a path already exists, it will error.
Two arguements are required. The first is the name of the path and the second is a array containing the various paths.
$zbg->setPath('somepath', @paths); if($zbg->{error}){ print "Error!\n"; }
This removes a specified path.
One arguement is taken and that is the name of the path to remove.
$zbg->delPath('somepath'); if($zbg->{error}){ print "Error!\n"; }
This fetches the default path.
my $path=$zbg->getDefaultPath; if($zbg->{error}){ print "Error!\n"; }
This fetches information on the last file set.
It also does not have to be checked for errors as it will never set an error.
No arguements are taken.
my %last=$zbg->getLast; if(!defined($last{file})){ print "No previous last.\n"; }else{ print 'file: '.$last{file}."\n". 'filltype: '.$last{filltype}."\n". 'display: '.$last{display}."\n". 'hostname: '.$last{hostname}."\n"; }
Gets the last variable in it's raw form.
For a description of it's formatting, please see
my $rawlast=$zbg->getLastRaw(); print $rawlast;
This fetches a specified path.
One arguement is taken and that is the path name.
The returned value is an array
my @paths=$zbg->getPath('somepath'); if($zbg->{error}){ print "Error!\n"; }
This gets what the current set is.
my $set=$zbg->getSet; if($zcr->{error}){ print "Error!\n"; }
This fetches a setter.
The only image accepted is the name of the setter to fetch.
my $setter=$zbg->getSetter('full'); if($zbg->{error}){ print "Error!\n"; } #escapes the image my $image='/tmp/something.jpg'; $image=~s/(["`\$\\ ])/\\$1/g; $image=~qq($image); #replaces %%%THEFILE%%% in the setter with the filename $setterr=~s/\%\%\%THEFILE\%\%\%/$image/g;
This initializes it or a new set.
If the specified set already exists, it will be reset.
One arguement is required and it is the name of the set. If it is not defined, ZConf will use the default one.
#creates a new set named foo $zbg->init('foo'); if($zbg->{error}){ print "Error!\n"; } #creates a new set with ZConf choosing it's name $zbg->init(); if($zbg->{error}){ print "Error!\n"; }
This gets a lists of configured paths.
my @paths=$zbg->listPaths(); if($zbg->{error}){ print "Error!\n"; }
This lists the available sets.
my @sets=$zbg->listSets; if($zcr->{error}){ print "Error!"; }
This verifies a path exists.
Only one arguement is taken and that is the name of the path.
my $returned=$zbg->pathExists('foo'); if($zbg->{error}){ print "Error!\n"; }else{ if(!$returned){ print "The path 'foo' does not exist.\n"; } }
This reads a specific set. If the set specified is undef, the default set is read.
#read the default set $zbg->readSet(); if($zbg->{error}){ print "Error!\n"; } #read the set 'someSet' $zbg->readSet('someSet'); if($zbg->{error}){ print "Error!\n"; }
The picture to set the background to.
The fill type to use. If this is not defined, the default one will be used.
If this is set to true, it will not be added to the last list.
$zbg->setBG({image='/tmp/something.jpg', filltype=>'auto'}); if($zbg->{error}){ print "Error!\n"; } #the same as the above, but not saved to the last list $zbg->setBG({image='/tmp/something.jpg', filltype=>'auto', dontSave='0'}); if($zbg->{error}){ print "Error!\n"; }
This sets the background image to last. It will also not re-append th e image to the last list.
No arguements are accepted.
$zbg->setLast(); if($zbg->{error}){ }
This sets a random background.
One option is accepted and that is the path to use. If it is note specified, 'default' will be used.
#set one from the default path $zbg->setRand(); if($zbg->{error}){ print "Error!\n"; } #set one from the default path $self->setRand('somepath'); if($zbg->{error}){ print "Error!\n"; }
This sets a sets/creates a path. If it is set, it will be overwritten.
Two arguements are required. The first is the name of the path and the second is a array ref containing the various paths.
$zbg->setPath('somepath', \@paths); if($zbg->{error}){ print "Error!\n"; }
Only one arguement is taken and that is the name of the setter.
my $returned=$zbg->setterExists('foo'); if($zbg->{error}){ print "Error!\n"; }else{ if(!$returned){ print "The setter 'foo' does not exist.\n"; } }
Sets the setter to be used for a specific fill type.
Two arguements are required. The first is the setter name and the second is setter.
$zbg->setSetter('full', 'hsetroot -full %%%THEFILE%%%'); if($zbg->{error}){ print "Error!\n"; }
Checks if a name specified for a setter is valid or not.
There is no reason to check for an error on this as it does not set any. It just checks that the specified name is valid. If it is not set, it will also return false.
if(!$zbg->validSetterName('monkey')){ print "No valid.\n"; } if(!$zbg->validSetterName('full')){ print "No valid.\n"; }
This blanks the error storage and is only meant for internal usage.
It does the following.
$self->{error}=undef; $self->{errorString}="";
The setter to use for setting fill the screen and keep the same aspect ratio.
The setter to use for setting the image to fill the screen.
The setter to use to center the image.
The setter to use to tile the image.
This will automatically choose between fill and full. The variable 'maxdiff' is used to determine what it should be set to.
Any thing matching the regex /^ft\// can also be used as a setter.
This contains the setter that will be used for when setting a centered image. '%%%THEFILE%%%' is replaced at runtime with the name of the file.
center=hsetroot -center %%%THEFILE%%%
This key contains setter to be used for fill the background with a resized image. '%%%THEFILE%%%' is replaced at runtime with the name of the file.
fill=hsetroot -fill %%%THEFILE%%%
This key contains setter to be used for fill the background with a scaled image. '%%%THEFILE%%%' is replaced at runtime with the name of the file.
full=hsetroot -full %%%THEFILE%%%
This contains the last several images set. There is one entry per line. The format is as below.
<hostname>:<display>:<fill type>:<image>
This contains the maximum difference for between any two any two sides when choosing between fill and full.
maxdiff=.2
The number of last entries to save.
This is the path to use for when selecting a random image.
This is a path. Each path have multiple paths. Each path is seperated by a new line.
Wether or not it should run something after it has been set. This is a perl boolean value.
postSetRefresh=0
If 'postSetRefresh' is set to true, this is ran.
This key contains setter to be used for tiling. '%%%THEFILE%%%' is replaced at runtime with the name of the file.
tile=hsetroot -tile %%%THEFILE%%%
Could not initialize ZConf.
ZConf error.
Failed to create the ZConf config 'zbgset'.
Autoinit errored.
Undefined arguement.
Invalid setter name.
Setter does not exist.
Could not determine the display.
Invalid hostname.
Invalid display name.
Image::Size::FillFullSelect->select failed.
The file does not exist.
The path does not exist.
No default path defined.
The path already exists.
Zane C. Bowers, <vvelox at vvelox.net>
<vvelox at vvelox.net>
Please report any bugs or feature requests to bug-zconf-bgset at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ZConf-BGSet. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-zconf-bgset at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc ZConf::BGSet
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=ZConf-BGSet
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/ZConf-BGSet
CPAN Ratings
http://cpanratings.perl.org/d/ZConf-BGSet
Search CPAN
http://search.cpan.org/dist/ZConf-BGSet
Copyright 2009 Zane C. Bowers, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install ZConf::BGSet, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ZConf::BGSet
CPAN shell
perl -MCPAN -e shell install ZConf::BGSet
For more information on module installation, please visit the detailed CPAN module installation guide.