# [[Perl_Background_Rotation/Screenshots|ScreenShot Gallery]] : If you use these scripts, show off!

# [[Perl_Background_Rotation/Screenshots|ScreenShot Gallery]] : If you use these scripts, show off!

Line 99:

Line 99:

Now, type <tt>wallie --status</tt>. If the daemon is correctly running, it will respond with an index of commands you can give it. To tell it to render the next set of images, execute <tt>wallie --next</tt>. In a few minutes you should have a new wallpaper.

Now, type <tt>wallie --status</tt>. If the daemon is correctly running, it will respond with an index of commands you can give it. To tell it to render the next set of images, execute <tt>wallie --next</tt>. In a few minutes you should have a new wallpaper.

Downloading

Installing

First of all, you need to make sure you have perl and imagemagick installed.

pacman -S imagemagick

or if your on a debian box (I have several)

apt-get install imagemagick

This script includes a number of perl modules (embedded). If you want to use more recent versions of these modules, see the Code Walkthrough for information on getting a non-embedded version of this script running.

Where to place the files

In the tarball, there are several included files. You should place them in the following locations.

wallie should be placed somewhere in your path. /usr/local/bin or your personal ~/bin directory (if it exists) work great.

extras/screenshot should be similarly placed as the wallie file.

If you plan on using the urxvt extension, place urxvt-theme and in your bin folder or in /usr/lib/urxvt/perl/.

backtile.jpg. These should both be copied into to root of your background directory (defaults to ~/.backgrounds/). blank.png is a 1x1 tranparent pixel which is read, stretched and otherwise mangled during the compositing process. backtile.png is a tiled image which is repeated across the conky and panel areas in order to give some texture. If you have a better tile, use it (and email it to me!)

the .wallrc config file

The configuration file should be mostly self-explanatory. But here are some things to be aware of.

The configuration file is basicly a set of perl hash declarations. It is therefore VERY sensitive to wierd punctuation. If you find you settings aren't taking hold, or the script is failing to load, make sure you don't have any mis-placed quotes and you are not missing any trailing semicolons.

Where you are given an option to fill in a pathname, you can use any variable perl normally has access to. For example, your home directory can be represented by $ENV{'HOME'}. If you find yourself repeating values, you can define your own (in perl format) and substitute them.

When a value is a number, you can surround it in quotes or not (you choice). All strings MUST be surrounded by double quotes.

cron / fcron setup

Once you have things running how you like - you may want to setup a cron job in order to automate things. I wont get into the detail of how cron works, but here is an example cron entry to run this script every 20 minutes:

*/20 * * * ~/bin/wallpaper

If your using fcron (which I highly encourage), you can tweak a bit more.

@lavg5(0.6),nice(10) 20 ~/bin/wallpaper

This will only run the command if the 5 minute system load average is low, and when it is run, it will run at a lower priority that it would normally. Swapping out wallpapers and rendering the new background can really hit slower cpu's hard - so nice is especially important on these machines in order to set a nice value. I've spent a lot of time tweaking the script so it does not use massive amounts of memory and cpu, but you need to realize that if you make use of any of the optional image manipulation features, every 20 minutes your machine is going to basicly perform several photo rendering operations. On ANY cpu that can create a bit of a cpu load.

That said, on my athlon xp 2800, the entire process (niced at 10), only takes about five seconds to complete (every possible option enabled). It seems to eat anywhere from 5 to 15 megs of ram to read all the images - do it's thing, and finish. It may act differently on slower systems. Let me know.

Window Manager setup

A couple of times a day, this script will generate a desktop so mind-blowingly awesome, I dont want it to go away :) If you find yourself in a similar conumdrum, you can .... with a flick of the key .... shut down the wallpaper randomization process. Once this "lock" has been placed, no more backgrounds will be generated even with your cron daemon ceaselessly hammering upon it.

In Openbox, I setup a keybinding to do this by editing ~/.config/openbox/rc.xml

This binds the "homepage" button on my logitech keyboard to lock the randomization process. Executing wallie --toggle again manually (or by hitting the home button) releases this lock. Note that all this does is call wallie --toggle.

Another button I bind is the browser button, which I use as a sort of "change the wallpaper NOW dangit!" button.

All this does is run the script right away. If your crazy, you could give this process a negative nice number with the help of sudo, and give your cpu a heart-attack. :)

Setting up keybinding in your own windowmanager of choice should be easier, but the above I think demonstrates a worst-case "really-hard-to-configure" scenario. :)

Testing and Running

To begin with, I suggest setting debug to a value of 2 in your configuration file. When your ready, simply type "wallie" to start the wallpaper process. It will check your configuration and make sure your settings are mostly sane and fork itself as a daemon process.

At this point, I suggest opening another xterm and typing tail -f ~/.wall.log which is the wallie log file. Once you have tested for a working configuration, set debug back to 0 and this file wont be created unless there is a castrophic error of some kind.

Now, type wallie --status. If the daemon is correctly running, it will respond with an index of commands you can give it. To tell it to render the next set of images, execute wallie --next. In a few minutes you should have a new wallpaper.