Difference between revisions of "User:Xterminus/Perl Background Rotation/Install"

From ArchWiki
Jump to: navigation, search
m
(11 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
[[Category:Perl Background Rotation]]
 
__NOTOC__
 
__NOTOC__
  
Line 18: Line 19:
 
== Downloading ==
 
== Downloading ==
  
Grab the [http://cmauch.googlecode.com/svn/wallpaper/wallie.tar.gz tarball]
+
Grab the [http://cmauch.googlecode.com/svn/wallpaper/tarballs/current.tar.gz current tarball] or [http://cmauch.googlecode.com/svn/wallpaper/tarballs older versions]
  
 
Individual files can be browsed via [http://cmauch.googlecode.com/svn/wallpaper googlecode's subversion] interface
 
Individual files can be browsed via [http://cmauch.googlecode.com/svn/wallpaper googlecode's subversion] interface
Line 39: Line 40:
  
 
* <b>wallie</b> should be placed somewhere in your path.  <tt>/usr/local/bin</tt> or your personal <tt>~/bin</tt> directory (if it exists) work great.
 
* <b>wallie</b> should be placed somewhere in your path.  <tt>/usr/local/bin</tt> or your personal <tt>~/bin</tt> directory (if it exists) work great.
* <b>extras/screenshot</b> should be similarly placed as the wallie file.
+
* <b>extras/screenshot</b> and <b>extras/schemer</b> should also be placed somewhere in your path.
 
* If you plan on using the urxvt extension, place [http://cmauch.googlecode.com/svn/wallpaper/extras/urxvt/urxvt-theme urxvt-theme] and in your bin folder or in <tt>/usr/lib/urxvt/perl/</tt>.
 
* If you plan on using the urxvt extension, place [http://cmauch.googlecode.com/svn/wallpaper/extras/urxvt/urxvt-theme urxvt-theme] and in your bin folder or in <tt>/usr/lib/urxvt/perl/</tt>.
 
* Now copy [http://cmauch.googlecode.com/svn/wallpaper/config/wallrc wallrc] into your home home directory as <tt>.wallrc</tt>   
 
* Now copy [http://cmauch.googlecode.com/svn/wallpaper/config/wallrc wallrc] into your home home directory as <tt>.wallrc</tt>   
 
* Two images are supplied in the tarball
 
* Two images are supplied in the tarball
 
## [http://cmauch.googlecode.com/svn/wallpaper/blank.png blank.png]
 
## [http://cmauch.googlecode.com/svn/wallpaper/blank.png blank.png]
## [http://cmauch.googlecode.com/svn/wallpaper/backtile.jpg backtile.jpg].  These should both be copied into to root of your background directory (defaults to <tt>~/.backgrounds/</tt>).  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!)
+
## [http://cmauch.googlecode.com/svn/wallpaper/backtile.jpg backtile.jpg].  These should both be copied into to root of your background directory (defaults to <tt>~/.backgrounds/</tt>).  blank.png is a 1x1 transparent 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 .wallrc config file ===
Line 50: Line 51:
 
The [http://cmauch.googlecode.com/svn/wallpaper/config/wallrc configuration file] should be mostly self-explanatory.  But here are some things to be aware of.
 
The [http://cmauch.googlecode.com/svn/wallpaper/config/wallrc 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 <i>VERY</i> 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.
+
* The configuration file is basically a set of perl hash declarations.  It is therefore <i>VERY</i> sensitive to weird 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 <tt>$ENV{'HOME'}</tt>.  If you find yourself repeating values, you can define your own (in perl format) and substitute them.
 
* 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 <tt>$ENV{'HOME'}</tt>.  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.
 
* When a value is a number, you can surround it in quotes or not (you choice).  All strings MUST be surrounded by double quotes.
 +
* <b>Be sure to enable at least one display.  For most people, this means changing  <tt>$display->{'0.0'}{'enable' } = 0;</tt> to <tt>$display->{'0.0'}{'enable' }          = 1;</tt></b>
  
 
== Testing and Running ==
 
== Testing and Running ==
  
To begin with, I suggest setting debug to a value of 2 in your configuration file.  When your ready, simply type <tt>"wallie"</tt> to start the wallpaper processIt will check your configuration and make sure your settings are mostly sane and fork itself as a daemon process.
+
To begin with, I suggest setting debug to a value of 2 in your configuration file.  When your ready, simply type <tt>"wallie"</tt> to start the wallpaper daemonThe daemon will check your configuration and make sure your settings are mostly sane and fork itself.
  
At this point, I suggest opening another xterm and typing <tt>tail -f ~/.wall.log</tt> which is the wallie log file.  <i>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.</i>
+
At this point, I suggest opening another xterm and typing  
  
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.
+
tail -f ~/.wall.log
 +
 
 +
which will "watch" the wallie log file.  <i>Once you have tested for a working configuration, set debug back to 0 and this file wont be created unless there is a catastrophic error of some kind.</i>
 +
 
 +
Now, type
 +
 
 +
  wallie --help
 +
 
 +
If the daemon is correctly running, it will respond with an index of commands you can give it.  Example output:
 +
 
 +
Possible options are:
 +
  status, toggle, schemedata, scheme, next, photo, photodir, current,
 +
  version, or die:
 +
 
 +
To tell it to render the next set of images, execute  
 +
 
 +
wallie --next
 +
 
 +
In a few minutes you should have a new wallpaper.
 +
 
 +
If you want to test a particular photo, try
 +
 
 +
wallie --photo:0.0:/full/path/to/image.png
 +
 
 +
where 0.0 is your X display you have defined in .wallrc.  Then execute
 +
wallie --next
 +
to render it.
  
 
=== starting the daemon automatically ===
 
=== starting the daemon automatically ===
  
add it to .xinitrc?
+
You should probably add wallie to your .xinitrc or some other startup process.  You need not worry about starting multiple copies, as the daemon will not start itself twice.
  
 
=== cron / fcron setup ===
 
=== cron / fcron setup ===
  
Once you have things running how you like - you <i>may</i> 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:
+
Once you have things running how you like - you <i>may</i> want to setup a cron job in order to automate things.  Note that setting up a cron job is entirely optional.  If you prefer, you can run things manually, or via some hotkey in you r window manager.
 +
 
 +
To setup a cron job:
  
 
  crontab -e
 
  crontab -e
Line 80: Line 110:
 
  @lavg5(0.6),nice(10) 20 wallie --next
 
  @lavg5(0.6),nice(10) 20 wallie --next
  
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 <tt>nice</tt> 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 <i>ANY</i> cpu that can create a bit of a cpu load.
+
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 cpus hard - so <tt>nice</tt> is especially important on these machines in order to set a cpu usage 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 basically perform several photo rendering operations.  On <i>ANY</i> cpu that can create a bit of a 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.
+
On an Athlon XP 2800, the render process (niced at 10), takes about five seconds to complete (every possible option enabled, for three monitors).  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 ===
 
=== Window Manager setup ===
  
A couple of times a day, this script will generate a desktop so <i>mind-blowingly awesome</i>, 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.
+
A couple of times a day, this script will generate a desktop so <i>mind-blowingly awesome</i>, I don't want it to go away :)  If you find yourself in a similar conundrum, 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 <tt>~/.config/openbox/rc.xml</tt>
 
In [[Openbox]], I setup a keybinding to do this by editing <tt>~/.config/openbox/rc.xml</tt>
Line 105: Line 135:
 
All this does is run the script right away.  If your crazy, you could give this process a <i>negative</i> nice number with the help of sudo, and give your cpu a heart-attack. :)
 
All this does is run the script right away.  If your crazy, you could give this process a <i>negative</i> 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. :)
+
Setting up keybinding in your own window manager of choice should be easier, but the above I think demonstrates a worst-case "really-hard-to-configure" scenario. :)
  
 
<center><b>[[Perl_Background_Rotation|Prev: Introduction]] | [[Perl_Background_Rotation/Extensions|Next: Using Extensions]]</b></center>
 
<center><b>[[Perl_Background_Rotation|Prev: Introduction]] | [[Perl_Background_Rotation/Extensions|Next: Using Extensions]]</b></center>

Revision as of 16:20, 23 April 2012


This document describes how to get a basic configuration running. Configuration of extensions, and troubleshooting is covered in other documents.

  1. Introduction : What this does
  2. Installation : Getting the basics handled.
  3. Using Extensions : Optional feature setup.
  4. Script Extras : Related Software
  5. Tips and Tricks : Fun for the whole family!
  6. Hacking : How to create your own extensions
  7. Code : Code walkthrough and some design notes
  8. FAQ : Frequently Asked Questions
  9. Screenshot Gallery : If you use these scripts, show off!
  10. Resources : A comprehensive wallpaper list.

Downloading

Grab the current tarball or older versions

Individual files can be browsed via googlecode's subversion interface

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 and extras/schemer should also be placed somewhere in your path.
  • If you plan on using the urxvt extension, place urxvt-theme and in your bin folder or in /usr/lib/urxvt/perl/.
  • Now copy wallrc into your home home directory as .wallrc
  • Two images are supplied in the tarball
    1. blank.png
    2. backtile.jpg. These should both be copied into to root of your background directory (defaults to ~/.backgrounds/). blank.png is a 1x1 transparent 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 basically a set of perl hash declarations. It is therefore VERY sensitive to weird 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.
  • Be sure to enable at least one display. For most people, this means changing $display->{'0.0'}{'enable' } = 0; to $display->{'0.0'}{'enable' } = 1;

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 daemon. The daemon will check your configuration and make sure your settings are mostly sane and fork itself.

At this point, I suggest opening another xterm and typing

tail -f ~/.wall.log

which will "watch" 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 catastrophic error of some kind.

Now, type

wallie --help

If the daemon is correctly running, it will respond with an index of commands you can give it. Example output:

Possible options are:
 status, toggle, schemedata, scheme, next, photo, photodir, current, 
 version, or die:

To tell it to render the next set of images, execute

wallie --next

In a few minutes you should have a new wallpaper.

If you want to test a particular photo, try

wallie --photo:0.0:/full/path/to/image.png

where 0.0 is your X display you have defined in .wallrc. Then execute

wallie --next

to render it.

starting the daemon automatically

You should probably add wallie to your .xinitrc or some other startup process. You need not worry about starting multiple copies, as the daemon will not start itself twice.

cron / fcron setup

Once you have things running how you like - you may want to setup a cron job in order to automate things. Note that setting up a cron job is entirely optional. If you prefer, you can run things manually, or via some hotkey in you r window manager.

To setup a cron job:

crontab -e
*/20 * * * wallie --next

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

fcrontab -e
@lavg5(0.6),nice(10) 20 wallie --next

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 cpus hard - so nice is especially important on these machines in order to set a cpu usage 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 basically perform several photo rendering operations. On ANY cpu that can create a bit of a load.

On an Athlon XP 2800, the render process (niced at 10), takes about five seconds to complete (every possible option enabled, for three monitors). 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 don't want it to go away :) If you find yourself in a similar conundrum, 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


<keybind key="XF86HomePage">
  <action name="execute"><execute>wallie --toggle</execute></action>
</keybind>

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.

<keybind key="XF86WWW">
  <action name="execute"><execute>wallie --next</execute></action>
</keybind>

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 window manager of choice should be easier, but the above I think demonstrates a worst-case "really-hard-to-configure" scenario. :)

Prev: Introduction | Next: Using Extensions