Subject: Re: FVWM: Random colorset when switching desks?

From: Dominik Vogt <[email-masked]>
Date: Sun, 1 Aug 2004 18:43:46 +0200

On Sat, Jul 31, 2004 at 06:56:02PM -0400, krispyfi wrote:
> Hello all. please bear in mind that i am a total linux noob.
> 
> I'm trying to get fvwm to display a random background image every time i 
> switch to a certain desktop. I somehow managed to bang out a shellscript 
> to be exec'ed by fvwmbacker with the last line being something like 
> "fvwm-root $randomWallpaper".
> 
> That was all well and good, but on my slow machine it would take like 5 
> seconds to switch. I heard about using colorsets to pre-cache 
> wallpapers, but then how do i call up a random colorset? fvwm-root won't 
> take a colorset as an argument. my second try was to use piperead. as in 
> "fvwmbacker (desk 0) piperead randColorset.sh" with the last line of 
> randColorset being like "echo $randomColorset" It doesn't work.

> if i am understanding this correctly, "echo" sends the string to 
> standard out

Correct.

> which piperead redirects to fvwmbacker.

no, it redirects the output to fvwm to execute.  FvwmBacker never
gets any reply.

> what am i doing 
> wrong? i know piperead works because im using it to read the output of a 
> script that looks in my wallpaper folder and assigns the wallpapers to 
> colorsets. and i know the colorsets work because i can say like 
> "fvwmbacker (desk 0) colorset 80"
> and it will change to the wallpaper assigned to colorset 80 in the script.
> 
> any help is appreciated

FvwmBacker currently does not support dynamic configuration.  The
colour set number can not be changed without restarting
FvwmBacker.  Actually, this is a problem with most modules, not
just FvwmBacker.  To get around the problem, do this:

  * Name your images bg_1.xpm to bg_<n>.xpm.

  * Reserve a colour set for each background image, e.g.

      Colorset 21 pixmap bg1.xpm
      Colorset 22 pixmap bg2.xpm
      Colorset 23 pixmap bg3.xpm
      ...

    This takes care of caching the images.

  * Make a colour set for FvwmBacker to use:

      Colorset 20 pixmap bg1.xpm
      *FvwmBacker: Command (Desk *) Colorset 20

    Note that the colour set never changes.

  * Use FvwmEvent to change the image in 

      *FvwmEvent: cmd 
      *FvwmEvent: new_desk "piperead 'echo colorset 20 pixmap bg_$$[RANDOM % 3 + 1].xpm'"

    (replace the 3 with the actual number of images).

Whenever the desk is changes, FvwmEvent updates colour set 20.
This should be fast because the image is already cached.

Ciao

Dominik ^_^  ^_^

 --
Dominik Vogt, [email-masked]
Reply-To: [email-masked]