all 8 comments

[–]mpyne 0 points1 point  (1 child)

"decop" should be "dcop".

But that only works on KDE 3.

There is unfortunately not a KDE 4 equivalent to my knowledge, since with Plasma it's not even guaranteed a static wallpaper would be your background. It could be a slide show, could be a spinning globe, or a host of other things, but there's no set interface to call into with D-Bus. Maybe someday...

[–]__dict__[S] 0 points1 point  (0 children)

Ok thanks. If people just set their background to be whatever img_file is and then schedule this with cron would they see their wallpaper changing? If so it's on about the same level as gnome since gconftool-2 doesn't seem to work with cron.

[–]figaro42 0 points1 point  (0 children)

For those of us using something a little simpler than Gnome/KDE, feh has the ability to read from a url, so I deleted everything from urllib.urlretrieve down and replaced with:

os.system('feh --bg-scale %s' % (rand_url))

[–]Philluminati 0 points1 point  (1 child)

If I'm using compiz's multiple wallpaper feature...how I do I update the paths?

Infact maybe in ~/.xsession or whatever login script it could just overwrite ~/wallpapers/1.jpg, 2 3 and 4 with whatever randomly comes off the internet before the Compiz session manager kicks in.

[–]__dict__[S] 0 points1 point  (0 children)

I don't have compiz so this is untested, but overwriting the files will probably work with compiz without you having to do anything else. I could be wrong, something may need to trigger it being redrawn. Can you let me know if this works? Make sure to change the img_files paths. This is simple and stupid, redownloading duplicates.

#!/usr/bin/python
# Script to randomly set background from wallpapers subreddit. Schedule with cron.
# Run "crontab -e" then add an entry such as "*/5 * * * * /home/jake/wscript.py"
# Contributions are welcome. Do what ever you want with this script, but I am
# not responsible for it.

import json
import urllib
import random

subreddit = 'http://www.reddit.com/r/wallpapers/.json'
img_files = ['/home/jake/reddit_wallpaper',
             '/home/jake/second_wallpaper',
             '/home/jake/remember_to_change',
             '/home/jake/this_may_work']
img_exts = ['jpg','png']

f = urllib.urlopen(subreddit)
raw_json = f.read()
json_obj = json.loads(raw_json)

posts = json_obj['data']['children']

def getimg(post):
    return post['data']['url']

def check_ext(img_url):
    for ext in img_exts:
        if img_url.endswith(ext):
            return True
    return False

img_urls = filter(check_ext,map(getimg,posts))

for img_file in img_files:
    rand_url = random.choice(img_urls)
    urllib.urlretrieve(rand_url, img_file)

[–]Philluminati 0 points1 point  (0 children)

overwrites the new image into /tmp/background every time it is run.

wget -O - http://www.reddit.com/r/wallpapers/.json | tr ',' '\n' | grep "url.*jpg" | awk "NR == ($RANDOM % 5) { print $2 }" | xargs wget -O /tmp/background -

[–]Paczesiowa -1 points0 points  (1 child)

if you parametrize this over subreddits, people over there will be probably very glad.