[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Autorn of program on KDE login?

On Sun, Jan 23, 2005 at 09:19:38AM -0500, stan wrote:
> I'm trying to convert a setup from Gnome 1.4 to something current. So far
> I'm leaning in the direction of KDE, as it seems more customizable than
> the current flavor of Gnome (which BTW sunrises me).
> In any case, I have a perl script that picks a random image to use for a
> desktop background. In Gnome 1.4, I'm able to configure this program to be
> run automatically at startup.
> So far, I have not found a way to do this in KDE. Is there some way I can
> do this?

On my desktop, I have a cron job run as my user that grabs a new picture
or wallpaper every 5 minutes.  I've tested it with fluxbox, xfce4, and
Gnome.  Gnome's gconf interface will let you change the location of the
wallpaper, as long as the filename is different than the last time.


# Export what display we're using
export DISPLAY=:0.0

# A temporary location

# A list of all possible wallpaper

# The actual wallpaper path & name

# The directories of where we should find wallpaper
bg_loc="/home/jeremy/pub/pictures /home/jeremy/pub/wallpaper"

# Check to see if the bg_list is more than 10 min old
if [ $(( `date +%s -r $bg_list &> /dev/null` + 630 )) -lt  `date +%s` ]
	#echo "File is out of date and needs to be updated!"
	find $bg_loc | grep -E "*.jpg" > $bg_list

# Grab a random line number from $bg_list
rand=$(( $RANDOM % `cat $bg_list | wc -l` ))

# Grab the filename of the random line number
rand_file=`cat $bg_list | tail -n $rand | head -n 1`

# Copy the wallpaper to the tmp location
cp "$rand_file" "$tmp_loc"

# Move the random file to our know filename
mv "$tmp_loc/`basename "$rand_file"`" "$tmp_loc/$wall_base"

# Find what directory the picture came from
bg_dir=`dirname "$rand_file"`
bg_dir=`basename "$bg_dir"`

# Add the directory into the picture
/usr/bin/convert -font "Bitstream Vera Sans" -fill navy -draw "text 150,150 \"$bg_dir\"" -pointsize 72 "$wallpaper" "$wallpaper"

# if fluxbox/blackbox
fbpid=`pidof fluxbox`

if [ $fbpid ] 
	#echo "Found Fluxbox: $fbpid"
	fbsetbg -a "$wallpaper"

# if gnome
gnpid=`pidof gnome-session`
if [ $gnpid ]
	# With Gnome/gconf, the filename must be named differently each time,
	# or else the change doesn't hold.  Instead of using the converted 
	# graphic, I just grab the random file.
	#echo "Found Gnome: $gnpid"
	gconftool-2 -t str -s /desktop/gnome/background/picture_filename "$rand_file"

# if xfce4
xfpid=`pidof xfdesktop`
if [ $xfpid ]
	#echo "Found XFCE4: $xfpid"

Reply to: