Gentoo Forums
Gentoo Forums
Quick Search: in
gnome desktop changer
View unanswered posts
View posts from last 24 hours

rackathon
 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Mooff
n00b
n00b


Joined: 04 Feb 2006
Posts: 7

PostPosted: Sun Mar 05, 2006 4:32 pm    Post subject: gnome desktop changer Reply with quote

Hi all,

can someone tell me where to find a desktop changer for gnome? (i want a tool which changes the backround every 20min or something by selecting a random wallpaper out of my wallpaper folder)


Search for such a tool and didn't found one.


Hope you can help me
Mooff
Back to top
View user's profile Send private message
Philz
n00b
n00b


Joined: 31 Oct 2004
Posts: 51
Location: Switzerland

PostPosted: Sun Mar 05, 2006 5:14 pm    Post subject: Reply with quote

I know of
http://users.skynet.be/bk221183/
and
https://wiki.ubuntu.com/RotateWallpapers src only


Haven't used them though..
_________________
Sorry, no time for a sig.
Back to top
View user's profile Send private message
ZZamboni
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jan 2004
Posts: 96
Location: Zurich, Switzerland

PostPosted: Mon Mar 06, 2006 7:30 am    Post subject: Re: gnome desktop changer Reply with quote

Mooff wrote:
can someone tell me where to find a desktop changer for gnome? (i want a tool which changes the backround every 20min or something by selecting a random wallpaper out of my wallpaper folder)


Something like this should work - change IMGDIR as appropriate, write the script to a file, and execute it from cron every once in a while, and it will change the background.

Code:
#!/bin/bash

IMGDIR=$HOME/lib/images/backgrounds

getrandomimg()
{
  ls $IMGDIR | perl -e '@f=<>; print $f[int(rand($#f+1))]'
}

IMG1=`getrandomimg`
gconftool-2 -s /desktop/gnome/background/picture_filename -t string "$IMG1"


To execute it from cron say, every 20 minutes, write the file to (for example) $HOME/bin/changebg.sh, and then run "crontab -e" and add a line like this:

Code:
*/20 * * * * /bin/sh $HOME/bin/changebg.sh
Back to top
View user's profile Send private message
PaulBredbury
Veteran
Veteran


Joined: 14 Jul 2005
Posts: 5931

PostPosted: Mon Mar 06, 2006 7:41 am    Post subject: Reply with quote

Implementation in Python:
Code:
#!/usr/bin/python

"""
randomwallpaper - finds a random picture and sets it as wallpaper.
"""

import os
from random import choice


# List of all the folders you want to scan
folders = ['/home/whoever/Wallpaper', '/home/whoever/Another wallpaper directory']


def doubleUpSingleQuotes(strSQL):
 
    return strSQL.replace("'", "''")


os.nice(20)
imgs = []
for d in folders:
    if os.path.exists(d) and os.path.isdir(d):   # Is it a valid folder?
        for f in os.listdir(d):                  # Get all files in that folder
            imgs.append(d + os.sep + f)          # Add it to our list

wallpaper = doubleUpSingleQuotes(choice(imgs))   # Get a random entry from our list
cmd = "gconftool-2 --type=string --set /desktop/gnome/background/picture_filename '" \
   + doubleUpSingleQuotes(wallpaper) + "'"
os.system(cmd)                                   # Set wallpaper
Back to top
View user's profile Send private message
duckz
Apprentice
Apprentice


Joined: 26 Jun 2007
Posts: 157

PostPosted: Thu Apr 17, 2008 9:45 am    Post subject: Reply with quote

Code:


#!/bin/bash

IMGDIR=/home/duckz/Images
SLEEPTIME=60 # in seconds
while [ 1=1 ] ;

do

getrandomimg()
{
  ls $IMGDIR | perl -e '@f=<>; print $f[int(rand($#f+1))]'
  }
   
  IMG1=`getrandomimg`
  e17setroot -s $IMGDIR/$IMG1
  Esetroot -s $IMGDIR/$IMG1
                           
        sleep $SLEEPTIME   
done




slightly modified for enlightenment background change and added time control to change the background every xxx seconds.
_________________
So you want to be a GENTOO?

emerge -va http://duckzland.ismywebsite.com <- install my blog in gentoo
./configure http://papero.0fees.net <- configure your wallpaper
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum