User:Xterminus/Perl Background Rotation
This page describes a set of perl scripts Charles Mauch wrote to rotate his wallpaper. Eventually they evolved to incorporate other features, so this page was setup to document usage of these scripts, how the code works, etc. If you wish to make a comment on this script, email [Charles] or discuss it in this thread on the bbs.
- This script picks different categories of backgrounds depending the current time of the day. For example, during the morning I like my backgrounds to be bright and cheerful, and as the day progresses I like the mood to become more technical and unobtrusive. After work ends, the backgrounds start to include "racier" photos. But by early morning it's back to landscapes and anime. This is by far my favorite feature.
- When it picks an new background, if that photo's name matches any of the previous 5 background's displayed, it picks another. In addition, it favors newer files over old files. This seems to work really well at keeping great (older) photos in circulation without repeating them so often you get bored with them. The list of 5 previously displayed backgrounds is maintained to keep really new photo from "flip-flopping" or showing up within a few minutes of the last time it was displayed.
- The script reads the average "color" of the selected background image and creates a color scheme/palatte based on that color. If a photo is too white, it will select from a pre-defined list of color schemes. It then slurps up a template conky configuration file and spits out a new conky configuration with the colors from the photo "theme". It will also send a SIGUSR1 signal to your conky process to tell it to reload it's config so the changes show up without having to reload conky or lose your neat graphbar data. In the event that a particular photo looks horrible with the the automatically chosen color or cropping pattern, you can override it by adding some metadata to the wallpaper's filename.
- A border area around the screen is created for transparent panels and conky (using the above mentioned color scheme). The sizes of both this top and right border are configurable, and the script will grab the screen resolution off of your monitor to scale the "photo" area to an appropriate size. Tiling backgrounds work with this too.
- It creates a neat preview "icon" of the next photo to be displayed. It's a neat effect, which I created for no other reason than my conky stats did not extend all the way down the screen and I wanted to put something there in that empty space.
- If the perfect background appears and you want to keep it displayed for a few hours, you can freeze the randomization process with a simple keybinding in your windowmanager.
- Works great with dualhead systems. If you have a seperate non-xinerama monitor, it will display the "next" image on it - so you dont have the same photo showing up on both monitors.
- I'm sure there are other features I've forgotten about too... I'll slowly add to this page.
Here is an example showing two radically different auto-generated themes.