Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I am using ubuntu 8.04 with Gnome
I was wondering if there is any software that I can use to
change the background at a certain time interval I will use anytype of
software available. Also is there any software that can play videos
as a background. It would be great if it was possible to play youtube
vid
John
Failure is not an option:It comes bundled with windows
#!/bin/bash
# random_wallpaper.sh
# Reads a given directory and set a random
# wallpaper using the images on that dir.
# Set WALLPAPERDIR and change feh --scale-bg
# to your likings
WALLPAPERDIR="$HOME/wallpapers"
if [[ -d "${WALLPAPERDIR}" ]]
then
files=$(ls "${WALLPAPERDIR}")
file_matrix=($files)
num_files=${#file_matrix[*]}
feh --bg-scale "${WALLPAPERDIR}/${file_matrix[$((RANDOM%num_files))]}"
fi
exit 0
You can set up your window manager or desktop to launch this script at startup. An extended version of the script would be this:
Code:
#!/bin/bash
# random_wallpaper_slideshow.sh
# Reads a given directory and set a random
# wallpaper using the images on that dir.
# The script stays resident until you kill it
# and changes the background periodically.
# The period is adjustable by the sleep command
WALLPAPERDIR="$HOME/wallpapers"
if [[ -d "${WALLPAPERDIR}" ]]
then
while(true)
do
files=$(ls "${WALLPAPERDIR}")
file_matrix=($files)
num_files=${#file_matrix[*]}
feh --bg-scale "${WALLPAPERDIR}/${file_matrix[$((RANDOM%num_files))]}"
sleep 10m
done
fi
exit 0
Again, how to launch it at startup is a thing of the wm or de. Remember: this script will stay around in memory until you kill it. So, if it's launched when you enter your session, then you exit the session and open another session, and you don't kill the script when closing sessions, you will have many instances of it running in the background, which can have undesired effects :P
For the videos (including flv files from youtube) you can use mplayer, maximized, without border and window titles and sticked to the background of the desktop. How to configure the window to look adequately is up to you and your window manager or desktop environment.
Of course, this are just my home made solutions because I don't use big desktops nor strange tools for these things. There might be specific tools for this, but I don't know about them.
I must add that doing $(ls) is not a good practice, it fails when the filenames contain spaces, it is far better to use pathname expansion or the 'find' command at least.
see BashPitfalls#1
Heres still another script. I named it wploop
This uses the hsetroot tool to display (jpg) pictures in a specified folder (and its subfolders) in a sequence.
Upon startup it checks the last picture that was displayed and continues from there.
Usage: wploop DELAY [IMAGE_PATH]
IMAGE _PATH only needs to be specified on the first run, or after new images have been added to the folder. DELAY is in seconds.
Sanity checking for input attributes in far from perfect, so be careful about what you throw at it.
Code:
#!/bin/bash
# At least the image switching delay needs to be specifed on cmd line
delay=${1?"Usage: wploop DELAY [IMAGE_PATH]"}
# Make sure the image switching delay is not unreasonably small
if [ "1" -gt "$delay" ]; then
echo Minimum delay is 1 seconds
exit
fi
# If the second parameter has been specified, it is interpreted as a path to image folder
imgPath=${2-*}
if [ "$imgPath" != "*" ]; then
find "${imgPath}" | grep -i .jpg > .background_list
fi
if [ ! -e .background_list ]; then
echo No image list to load!
exit
fi
if [ ! -e .background_no ]; then
echo > .background_no 0
fi
# Get the number of images in the image list
img_no_max=`awk 'END {print NR}' .background_list`
# Set the next root window image, delay for a while, repeat..
while [ 1 ]; do
# Get the order number of the previous image in the image list
img_no=`cat .background_no`
# Increase the order number for the next image. Reset the count if last image has been displayed
img_no=$[$img_no+1]
if [ "$img_no" -gt "$img_no_max" ]; then
img_no=1
fi
echo > .background_no $img_no
# Get the image name, according to the order number
img_name=`awk -v no=$img_no 'NR==no {print}' .background_list`
# Display the image
hsetroot -center $img_name
sleep $delay
done
I must add that doing $(ls) is not a good practice, it fails when the filenames contain spaces, it is far better to use pathname expansion or the 'find' command at least.
see BashPitfalls#1
I just looked up "random wallpaper" in Synaptic and this came up under the application name 'wallpaper-tray'. I, unfortunately, am looking for something for KDE that will just give me a new background image each time I startup.
I just looked up "random wallpaper" in Synaptic and this came up under the application name 'wallpaper-tray'. I, unfortunately, am looking for something for KDE that will just give me a new background image each time I startup.
for KDE to run things at startup you need to place a script at ~/.kde/Autostart all things there get automatically executed when KDE starts, then use the dcop command I posted before to set it.
I have a script that automatically downloads and sets as wallpaper the picture from APOD:
btw, the '8' at the end is the 'scale and crop' mode, you can use from 1 to 8 being 1 'Centered', 2 'Tiled', 3 'Center Tiled', 4 'Centered Maxpect', 5 'Tiled Maxpect', 6 'Scaled', 7 'Centered Auto Fit' and 8 'Scale & Crop'.
Last edited by Samus_; 08-11-2008 at 08:03 AM.
Reason: adding modes
If you want a graphic solution rather than a script, you can use this GkrellM plugin which changes the desktop background image at a specified time interval: GKrellM Background Changer
If you want a graphic solution rather than a script, you can use this GkrellM plugin which changes the desktop background image at a specified time interval: GKrellM Background Changer
EDIT: Just noticed that this thread is almost two years old, so I guess that the original poster have already solved his problem...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.