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

Offline longtom

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3530
  • Satellite Station Africa
How to create a wallpaper slideshow in LXDE
« on: March 01, 2011, 08: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, 09:12:49 AM by longtom »
Regards

longtom

Offline utu

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

Really neat.  Thanks for posting this.

Offline tony

  • Hero Member
  • ********
  • Posts: 3386
  • We're all different, nice
Re: How to create a wallpaper slideshow in LXDE
« Reply #2 on: August 06, 2011, 02: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 ;)

PCLinuxOS KDE Plasma 5 AMD Quad Core-8GB RAM-ITB SSHD
Make it rain for PCLinuxOS! *Perseverance Furthers.

Offline ⅆα√ℯℂ§

  • Hero Member
  • ********
  • Posts: 5851
  • PCLinuxOS: A revolution in personal computing
Re: How to create a wallpaper slideshow in LXDE
« Reply #3 on: September 05, 2011, 03: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 FX-4100 with 8Gb Ram using MSI760GM-P23 Mobo, and Lenovo B50-45 Laptop with AMD E1 processor, modified with SSD.

Offline longtom

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3530
  • Satellite Station Africa
Re: How to create a wallpaper slideshow in LXDE
« Reply #4 on: September 05, 2011, 03: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

Colinek

  • Guest
Re: How to create a wallpaper slideshow in LXDE
« Reply #5 on: October 21, 2011, 04: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: 4824
  • 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, 04: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: 3386
  • We're all different, nice
Re: How to create a wallpaper slideshow in LXDE
« Reply #7 on: October 21, 2011, 11: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 ,,,  )
PCLinuxOS KDE Plasma 5 AMD Quad Core-8GB RAM-ITB SSHD
Make it rain for PCLinuxOS! *Perseverance Furthers.

Neal

  • Guest
Re: How to create a wallpaper slideshow in LXDE
« Reply #8 on: October 22, 2011, 06:35:15 AM »
francis,
That was a genuine 'well-wishing' from Leiche. Nothing ominous in that. ::)     

Offline tony

  • Hero Member
  • ********
  • Posts: 3386
  • We're all different, nice
Re: How to create a wallpaper slideshow in LXDE
« Reply #9 on: October 22, 2011, 08: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.



PCLinuxOS KDE Plasma 5 AMD Quad Core-8GB RAM-ITB SSHD
Make it rain for PCLinuxOS! *Perseverance Furthers.

Neal

  • Guest
Re: How to create a wallpaper slideshow in LXDE
« Reply #10 on: October 22, 2011, 08:06:27 AM »
 ::) ::) ::)  ;) ;)     

Offline daniel

  • Global Moderator
  • Hero Member
  • ********
  • Posts: 4824
  • 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, 10:16:41 AM »
Humor what is it ???  ;D

Back to topic  ;)

Colinek

  • Guest
Re: How to create a wallpaper slideshow in LXDE
« Reply #12 on: October 22, 2011, 01: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: 4824
  • 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, 01:42:01 PM »
good to read, if it work for you  ;)

Offline zafran

  • Full Member
  • ****
  • Posts: 94
Re: How to create a wallpaper slideshow in LXDE
« Reply #14 on: March 15, 2012, 10: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