auto change random background in gnome

Nautilus Scripts

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net

0
Score 50.0%
Description:

This script will auto change background desktop by pictures from one folder after a period time that you set up.
Anyway, you can add many folders contains pictures you want but their path should not has any space character.
Maybe that's too late but I want to share it.
Hope it usefully to you!
Last changelog:

8 years ago

# Verion 0.1 :
# Verion 0.2 :
# Add function "custom options" from command

inameiname

8 years ago

Nice script, but one thing is there is a sleep process that you can't easily turn off as a result of the timer part. And, also, if you run it manually more than once, more than one sleep process that you can't turn off occurs.

Anyway, not to condone this script, as it does work just fine, here are a couple I prefer. And they handle spaces in paths and such.

###### Random wallpaper (add whatever wallpaper directory(s) you wish after 'BACKGROUND_DIRS')
#!/usr/bin/env python
BACKGROUND_DIRS = ['/usr/share/backgrounds', '~/Pictures/Backgrounds']
EXTENSIONS = ['jpeg', 'jpg', 'bmp', 'png', 'svg']
import os, glob, random, itertools, gconf
files = list(itertools.chain(*[[os.path.join(dirpath, name)
for name in filenames]
for dirpath, dirnames, filenames in
itertools.chain(*[os.walk(os.path.expanduser(d))
for d in BACKGROUND_DIRS])]))
gconf.client_get_default().set_string(
'/desktop/gnome/background/picture_filename',
random.choice(files))


###### Automatic wallpaper switcher for Gnome
#!/bin/bash
if [ $# -ne 2 ];then
echo -n "Usage: $0 directory_name timeout_in_seconds
Leave the directory name blank for Current Directory
For you lazy pal, I assume timeout as 5 sec and Directory as current
Do you want to accept this settings? (Y/n): ";
read response
if [[ "$response" =~ ^[^yY] ]];then
exit 0
fi
fi
function set_wallpaper() {
gconftool-2 -s /desktop/gnome/background/picture_options "centered" -t string;
gconftool-2 -s /desktop/gnome/background/picture_filename "$1" -t string;
}
TIMEOUT=${2-5};
WALL_DIR=${1-`pwd`};
echo "Timeout value is: $TIMEOUT";
echo "Directory is: $WALL_DIR";
echo
if [ ! -d "$WALL_DIR" ];then
echo "The Directory Specified is invalid..";
exit 1;
fi
filelst="$(find "$WALL_DIR" -type f -name '*.jpg' -o -name '*.png')";
if [ -z "$filelst" ];then
echo "No Suitable files found in this location: $WALL_DIR";
exit 1;
fi
while true;do
filename=`echo "$filelst" | shuf -n 1`
set_wallpaper "$filename";
sleep $TIMEOUT;
done
exit

Report

C

s8dtvt

8 years ago

That's right. Perhaps I will fix it next time.
Thanks.

Report

inameiname

8 years ago

Ah. Yeah, it became quite annoying that every time I tried to kill the 'sleep' processes they just kept returning. I had to restart just to get rid of them. hehe

Report

8 years ago

# Verion 0.1 :
# Verion 0.2 :
# Add function "custom options" from command

12345678910
product-maker Base: 4 x 5.0 Ratings
File (click to download) Version Description Downloads Date Filesize DL OCS-Install MD5SUM
*Needs ocs-url or ocs-store to install things
Pling
0 Affiliates
Details
license
version
0.2
updated Nov 22 2010
added Nov 22 2010
downloads 24h
0
page views 24h 1
System Tags addon