Subject: Re: Switching wm background using cron?
To: Michael Parson <mparson@bl.org>
From: Geert Hendrickx <geert.hendrickx@ua.ac.be>
List: netbsd-users
Date: 08/26/2005 22:30:39
On Fri, Aug 26, 2005 at 02:33:56PM -0500, Michael Parson wrote:
> On Fri, Aug 26, 2005 at 09:26:59PM +0200, Jan Danielsson wrote:
> > Hello all,
> > 
> >    I have written a small script which changes WindowMaker's background
> > to an image chosen randomly from a directory. The script calls
> > "wmsetbg". So, I thought I'd set up a cron job to change picture at a
> > certain interval. This worked good, until I quit X (obviously) since
> > wmsetbg no longer could communicate with WindowMaker.
> > 
> > The script is written in Python.
> > 
> > How do I find out if WindowMaker is running from my script?
> > 
> >    Or is there some other solution? (Like modifying cron when
> > WindowMaker starts/stops - seems highly unstable, though)?
> 
> Modify your cron job to check for a file that only exists when you're
> logged in.
> 
> Modify how your WindowMaker is started/stopped to touch this file and
> remove it when you log off.
> 
> Cron job will run, if that file exists, it will change your bg image, if
> not, it will exit and wait for it's next run.

Or start a script from within windowmaker, something like: 

while true
do
	change_bw
	sleep 60
done

If it's a child process of your session, it will quit when your session
ends.  

GH