LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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



Reply
 
Search this Thread
Old 05-31-2008, 01:31 PM   #1
theunixwizard
Member
 
Registered: Feb 2008
Distribution: Ubuntu,Fedora,PC-BSD,FreeBSD
Posts: 116

Rep: Reputation: 15
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
 
Old 05-31-2008, 04:26 PM   #2
nme
LQ Newbie
 
Registered: Nov 2005
Distribution: Ubuntu 8.10
Posts: 18

Rep: Reputation: 0
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.
 
Old 05-31-2008, 09:20 PM   #3
Samus_
LQ Newbie
 
Registered: May 2008
Distribution: ArchLinux
Posts: 7

Rep: Reputation: 0
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.
 
Old 05-31-2008, 10:42 PM   #4
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,049

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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.
 
Old 06-01-2008, 07:04 AM   #5
Samus_
LQ Newbie
 
Registered: May 2008
Distribution: ArchLinux
Posts: 7

Rep: Reputation: 0
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
 
Old 06-01-2008, 01:39 PM   #6
PMorph
Member
 
Registered: Sep 2003
Distribution: Debian
Posts: 213

Rep: Reputation: 31
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

Last edited by PMorph; 06-01-2008 at 01:41 PM.
 
Old 06-01-2008, 01:45 PM   #7
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
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.
 
Old 06-02-2008, 07:04 AM   #8
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,049

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Quote:
Originally Posted by Samus_ View Post
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
 
Old 07-01-2008, 10:46 AM   #9
domino1241
LQ Newbie
 
Registered: Mar 2005
Posts: 5

Rep: Reputation: 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.

Hope it works!

http://planetearthworm.com/projects/wp_tray/
 
Old 08-11-2008, 07:33 AM   #10
Samus_
LQ Newbie
 
Registered: May 2008
Distribution: ArchLinux
Posts: 7

Rep: Reputation: 0
Quote:
Originally Posted by domino1241 View Post
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'.

Last edited by Samus_; 08-11-2008 at 08:03 AM. Reason: adding modes
 
Old 04-24-2010, 02:22 PM   #11
sierraindigo
LQ Newbie
 
Registered: Apr 2010
Posts: 2

Rep: Reputation: 0
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
 
Old 04-24-2010, 02:56 PM   #12
ekj
Member
 
Registered: Apr 2007
Location: Sweden
Distribution: openSUSE
Posts: 37

Rep: Reputation: 16
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
 
Old 04-24-2010, 03:01 PM   #13
ekj
Member
 
Registered: Apr 2007
Location: Sweden
Distribution: openSUSE
Posts: 37

Rep: Reputation: 16
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...
 
  


Reply

Tags
bash, desktop, kde, wallpaper


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Refreshing Desktop Wallpaper - Address of Wallpaper beanus Linux - Desktop 4 07-16-2007 02:57 PM
Dynamic wallpaper changer in gnome WhiskeyTangoFoxtrot Linux - Software 1 10-14-2006 01:42 AM
FTP wallpaper changer verbose Linux - Software 0 08-05-2005 10:43 PM
Automated Wallpaper Changer davethegenius Linux - Software 3 04-02-2005 05:12 PM
random wallpaper changer for linux mlu Linux - Software 1 02-12-2005 12:12 AM


All times are GMT -5. The time now is 12:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration