Author Topic: How to create a wallpaper slideshow in LXDE  (Read 6044 times)

Offline longtom

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3339
  • Satellite Station Africa
How to create a wallpaper slideshow in LXDE
« on: March 01, 2011, 07:57:42 AM »
Some of you might remember this thread:

http://www.pclinuxos.com/forum/index.php/topic,74092.0.html

No?  You don't?  I do ….  ;D

Truth be told I never got it right to have a wallpaper slideshow running on Lxde.

Since Phoenix runs perfectly right now I went back to my Lxde install to fiddle and see what else I can break.  In a moment of weakness I went back to the wallpaper slideshow problem.

I googled again and struck gold in the Mint forum.

So here is how you get a wallpaper slideshow going in PCLinuxLXDE (Mini):

1. You need to create a location where you have all your wallpapers which you want to use.  
    In my setup it is /home/longtom/Wallpapers .
2. Open Leafpad in Menu > Editors
3. In leafpad enter the following:

   
Code: [Select]
#!/bin/bash

DIR=/home/longtom/Wallpapers/
FLOOR=1
RANGE=`ls -1 "$DIR"/*.jpg | wc | awk '// {print $1}'`

number=0

while [ 1 -eq 1 ]; do
  
   number=$RANDOM
   while [ "$number" -le $FLOOR ]; do
        number=$RANDOM
   done
   let "number %= $RANGE"  # Scales $number down within $RANGE.
   COUNTER=1
   for X in "$DIR"/*.jpg
   do
      if [ $number -eq $COUNTER ]; then
         pcmanfm --set-wallpaper "$X"
      fi
   COUNTER=$(($COUNTER+1))
   done
   COUNTER=1
   sleep 10m
done

You can change the time interval by changing the number in the line:
Code: [Select]
  sleep 10m
As you can see, mine is set to 10 minutes.

This script works only for jpg files as it stands but you can add other formats at will.

Also make sure that you replace longtom in
Code: [Select]
DIR=/home/longtom/Wallpapers
with your home folder's name.

Save your file in your "/home/user" folder.  I chose the name rotator.

In PCmanFM find your file, right click on it, choose "Properties > Permissions" and tick next to "Make the file executable".

Left click on your file and choose "Execute"

There she runs.

You can add this script to your LXDE autostart script.

One more thing.  If you only log out and back in you might suddenly have 2 sessions of this script running.  We don't want that.
In order to make sure our script stops when we log out we add the following line to our ".bashrc" in the /home/user directory:

Code: [Select]
alias lxlogout='killall -9 rotator | exit 0 && lxsession-logout'

That is it.  Test it and enjoy a new scenery on your desktop every so often to make life more colourful.

   
« Last Edit: March 01, 2011, 08:12:49 AM by longtom »
Regards longtom

PCLinuxOS KDE 32bit
Intel Core 2 Duo E2200 / 2.2 GHz
2GB Ram
Nvidia GT610

Offline utu

  • Jr. Member
  • **
  • Posts: 46
Re: How to create a wallpaper slideshow in LXDE
« Reply #1 on: July 04, 2011, 08:53:21 AM »
@ longtom

Really neat.  Thanks for posting this.

Offline Tony

  • Hero Member
  • *****
  • Posts: 1771
  • naturam expelles furca, tamen usque recurret
Re: How to create a wallpaper slideshow in LXDE
« Reply #2 on: August 06, 2011, 01:37:46 AM »
I've been using PCLinuxOS LXDE Mini (2011.6) for a couple of weeks now, alongside KDE MiniMe, and are real happy how nippy and fast it is.

This looks like an excellent lesson in following steps; which is good training for me, plus I like screensavers, or 'Slideshows'  ;D

At the moment I have a feeling that KDE MiniMe is controlling my screensaver, after about ten minutes after walking away from my Comp, it goes to Black screen, Monitor Power saving mode it seems. Anyway that's a whole other can of worms.  :P I hate cans of worms  :P

If I can do this I'll let you know, many thanks to you Mr. longtom ;)

PCLOS *MiniMe 2013 - KDE 4.10.1 + *LDXE Full  Computing is Fun with Linux, mostly ;) *Software Updates

Offline Ɗα√ϵς§

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5521
  • PCLinuxOS: A revolution in personal computing
Re: How to create a wallpaper slideshow in LXDE
« Reply #3 on: September 05, 2011, 02:00:43 PM »
Could this script be adapted to force a wallpaper change every time one changes desktops? Thus giving the effect of different wallpaper on each desktop?
PCLinuxOS has no wealthy sponsors and can only survive with your donations! Don't wait it might be too late.

Running PCLOS on Athlon II/250 with 2Gb Ram using ASUS M2N68-AM Plus Mobo with Nvidia GF7600GT graphics, and Samsung NC10 Netbook

Offline longtom

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3339
  • Satellite Station Africa
Re: How to create a wallpaper slideshow in LXDE
« Reply #4 on: September 05, 2011, 02:07:46 PM »
Could this script be adapted to force a wallpaper change every time one changes desktops? Thus giving the effect of different wallpaper on each desktop?


Good question!  Can I come back to you on this one? ...   ;)
Regards longtom

PCLinuxOS KDE 32bit
Intel Core 2 Duo E2200 / 2.2 GHz
2GB Ram
Nvidia GT610

Offline Colinek

  • New Friend
  • *
  • Posts: 2
Re: How to create a wallpaper slideshow in LXDE
« Reply #5 on: October 21, 2011, 03:20:37 PM »
Hi,

Great script. Works a treat. But when used with Cairo-Dock, (which I use in 'auto-hide' mode) I have to refresh the dock every time in order to see the full new picture on the desktop.

Any ideas how to correct this?

Offline daniel

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3794
  • God knows, i'm not an Angel!
    • Tipps und Tricks
Re: How to create a wallpaper slideshow in LXDE
« Reply #6 on: October 21, 2011, 03:30:10 PM »
add in script,
Code: [Select]
killall cairo-dock && sleep 0.3 && exec cairo-dock
under
Code: [Select]
if [ $number -eq $COUNTER ]; then
         pcmanfm --set-wallpaper "$X"

Result

Code: [Select]
if [ $number -eq $COUNTER ]; then
         pcmanfm --set-wallpaper "$X"
         killall cairo-dock && sleep 0.3 && exec cairo-dock

I don't use cairo-dock, so you must look if the command cairo-dock correctly.

Good luck

Offline Tony

  • Hero Member
  • *****
  • Posts: 1771
  • naturam expelles furca, tamen usque recurret
Re: How to create a wallpaper slideshow in LXDE
« Reply #7 on: October 21, 2011, 10:58:19 PM »
Quote
Good luck
Sounds a bit ominous ?   :D 
( As a rule of thumb, I've learnt things don't always work to plan, and are prepared, either for success, or the alternate outcome ,,,  )
PCLOS *MiniMe 2013 - KDE 4.10.1 + *LDXE Full  Computing is Fun with Linux, mostly ;) *Software Updates

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15829
  • LXDE! Coffee, Bacon and Cheesecake!
Re: How to create a wallpaper slideshow in LXDE
« Reply #8 on: October 22, 2011, 05:35:15 AM »
francis,
That was a genuine 'well-wishing' from Leiche. Nothing ominous in that. ::)     

Offline Tony

  • Hero Member
  • *****
  • Posts: 1771
  • naturam expelles furca, tamen usque recurret
Re: How to create a wallpaper slideshow in LXDE
« Reply #9 on: October 22, 2011, 07:04:11 AM »
OK Neal, thanks for clarifying.
I was being 'tongue in cheek', as the smiley alluded, but sure, your advice taken.

Recently, a failed attempt by myself using a 'Foolproof Tutorial' to install Avast! got this response from the writer:
Quote
Hahaha - Not at all. Weird stuff happens all the time to all of us and we cannot explain them.

Glad You have avast installed.
I did get the software installed, but had to modify the instructions which I guess in a long winded commandline operation is always on the cards. Thus I quipped about Leiche's obvious well intentioned help, as a sense of humor also prepares one to perservere if things don't workout first off.



PCLOS *MiniMe 2013 - KDE 4.10.1 + *LDXE Full  Computing is Fun with Linux, mostly ;) *Software Updates

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15829
  • LXDE! Coffee, Bacon and Cheesecake!
Re: How to create a wallpaper slideshow in LXDE
« Reply #10 on: October 22, 2011, 07:06:27 AM »
 ::) ::) ::)  ;) ;)     

Offline daniel

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3794
  • God knows, i'm not an Angel!
    • Tipps und Tricks
Re: How to create a wallpaper slideshow in LXDE
« Reply #11 on: October 22, 2011, 09:16:41 AM »
Humor what is it ???  ;D

Back to topic  ;)

Offline Colinek

  • New Friend
  • *
  • Posts: 2
Re: How to create a wallpaper slideshow in LXDE
« Reply #12 on: October 22, 2011, 12:31:08 PM »
Thanks Leiche.

Luck was clearly on my side and it is running perfectly now. ;D

Cheers

Offline daniel

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3794
  • God knows, i'm not an Angel!
    • Tipps und Tricks
Re: How to create a wallpaper slideshow in LXDE
« Reply #13 on: October 22, 2011, 12:42:01 PM »
good to read, if it work for you  ;)

Offline zafran

  • Jr. Member
  • **
  • Posts: 24
Re: How to create a wallpaper slideshow in LXDE
« Reply #14 on: March 15, 2012, 09:39:03 AM »
Great I was looking for the command
pcmanfm --set-wallpaper
for a lot.

I wrote a routine to build up mosaics of images from webcams and use them as wallpapers.
I ever used them in kde but in lxde I yet didn't find how to force the change of the wallpaper.

Thank you