LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Desktop Wallpaper Changer (http://www.linuxquestions.org/questions/linux-software-2/desktop-wallpaper-changer-646084/)

theunixwizard 05-31-2008 12:31 PM

Desktop Wallpaper Changer
 
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

nme 05-31-2008 03:26 PM

You might want to look at http://ubuntuforums.org/archive/index.php/t-2801.html. I use to have this in Red Hat 8, and have been looking for it since.

Samus_ 05-31-2008 08:20 PM

hmm I had this script in KDE a while ago:

Code:

#!/bin/bash

wallpapers=(~/Desktop/wallpapers/*)

wallpaper_count=${#wallpapers[@]}
random_wallpaper=${wallpapers[(((wallpaper_count - 1) * RANDOM / 32767))]}
dcop kdesktop KBackgroundIface setWallpaper "$random_wallpaper" 4

perhaps gnome has some commandline method of changing the wallpaper as to port this; about the videos I have no idea.

i92guboj 05-31-2008 09:42 PM

For pictures:

Code:

#!/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.

Samus_ 06-01-2008 06:04 AM

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

PMorph 06-01-2008 12:39 PM

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


pwc101 06-01-2008 12:45 PM

Perhaps this is what you're after? http://wallpapoz.akbarhome.com/

Note: I haven't used this as I use KDE 3.5.9 which has this function built in.

i92guboj 06-02-2008 06:04 AM

Quote:

Originally Posted by Samus_ (Post 3170996)
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

True, I disregard it's use always. :P

domino1241 07-01-2008 09:46 AM

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.

Hope it works!

http://planetearthworm.com/projects/wp_tray/

Samus_ 08-11-2008 06:33 AM

Quote:

Originally Posted by domino1241 (Post 3200321)
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.

Hope it works!

http://planetearthworm.com/projects/wp_tray/

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:
Code:

#!/bin/sh

wget 'http://antwrp.gsfc.nasa.gov/apod/astropix.html' -qO- | awk 'BEGIN { RS="</a>"; } /IMG/ { print("http://antwrp.gsfc.nasa.gov/apod/" gensub(/.*<a href="([^"]+)">.*/, "\\1", "")); }' | wget -qi- -O ~/.apod.jpg && dcop kdesktop KBackgroundIface setWallpaper ~/.apod.jpg 8

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'.

sierraindigo 04-24-2010 01:22 PM

Random NASA Astronomy Picture Of the Day (APOD) perl script
 
available here APOD perl script. it takes a random picture from the APOD archives and loads it up as your wallpaper

ekj 04-24-2010 01:56 PM

GkrellM plugin
 
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

ekj 04-24-2010 02:01 PM

GkrellM plugin
 
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...


All times are GMT -5. The time now is 05:34 AM.