Easy to use random wallpaper changer

Window managers, icon programs, widgets, etc.
Message
Author
rmcellig
Posts: 965
Joined: Sat 19 Nov 2011, 15:18
Location: Ottawa Ontario Canada
Contact:

Easy to use random wallpaper changer

#1 Post by rmcellig »

So far this is all I found. Is there anything else that is very easy to use and setup for Puppy Linux? I have a friend of mine who is thinking of changing from Windows XP to Puppy Linux and she asked me if there was an easy wallpaper changer that she could use.

http://www.murga-linux.com/puppy/viewtopic.php?t=37561

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#2 Post by SFR »

Could be something like this?
It's just a "one minute work", but so far it works quite well.

Code: Select all

#!/bin/bash

# Randomly changes the wallpaper at fixed time intervals

INTERVAL=10		# in seconds

while true; do
  sleep $INTERVAL
  WALLPAPER=`ls /usr/share/backgrounds | sort -R | head -1`
  set_bg "/usr/share/backgrounds/$WALLPAPER"
done
Adjust the time interval to your needs, save the script as "randomwallpaper" to /root/Startup and make it executable.
Now click on it.
To stop the script, open terminal and type:

Code: Select all

killall randomwallpaper
Hopefully, should work on Puppies with Nathan Wallpaper Setter (mine is Lupu-528.005).

Hope this helps.
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

rmcellig
Posts: 965
Joined: Sat 19 Nov 2011, 15:18
Location: Ottawa Ontario Canada
Contact:

#3 Post by rmcellig »

Thanks! Is there anything I need to do when I create a script? I have never created a script before but this looks pretty straightforward.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#4 Post by SFR »

rmcellig wrote:Thanks! Is there anything I need to do when I create a script? I have never created a script before but this looks pretty straightforward.
Just copy the code into Geany, save it as randomwallpaper to /root/Startup, and then:
right-click -> File 'randomwallpaper' -> Properties and check all boxes under "Exec".
The script will start automatically at every boot.

Nothing more is required, I believe. :)

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

rmcellig
Posts: 965
Joined: Sat 19 Nov 2011, 15:18
Location: Ottawa Ontario Canada
Contact:

#5 Post by rmcellig »

Thanks!

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#6 Post by Lobster »

Now part of Puppy Hacker School code
http://puppylinux.org/wikka/PuppySchoolProgramming

Puppy Linux
Solutions for penguins
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

Jim1911
Posts: 2460
Joined: Mon 19 May 2008, 20:39
Location: Texas, USA

#7 Post by Jim1911 »

Thank you SFR! :D

User avatar
mikeslr
Posts: 3890
Joined: Mon 16 Jun 2008, 21:20
Location: 500 seconds from Sol

Thanks SFR & 2 comments

#8 Post by mikeslr »

Thanks SFR,

Just the little nicety I was looking for.

Just 2 comments:

(1) You code uses the background folder. If someone doesn't want to use all, or any of the backgrounds located there, a folder (for example, backgrounds1) can be created and the desired Wallpaper.jpgs placed there. In such case, the relevant portion of your code would read:

WALLPAPER=`ls /usr/share/backgrounds1 | sort -R | head -1`
set_bg "/usr/share/backgrounds1/$WALLPAPER"

(2) More importantly, the desired jpgs should first be resized to your monitor's settings. Apparently, if they are larger than your monitor's max, they are "centered" with only their central portions appearing: i.e, edges not displayed. Perhaps this description is not technically correct. It's just how it appears to me.

But anyway, a great addition to Puppies.

Thanks again,

mikesLr

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#9 Post by SFR »

Thanks to all of you for appreciation. :)

@mikeslr:

1. Good thinking.
2. Good point, I have had stretched wallpaper already set, before running the script, so didn't notice the fact.
Anyway, it's fixed now, thanks.

For those who are having wbar installed and don't want to reload it manually, a small addition - automatic reload every time wallpaper changes.

Code: Select all

#!/bin/bash

# Randomly changes the wallpaper at fixed time intervals

INTERVAL=10				# in seconds
PIX_PATH=/usr/share/backgrounds		# path to wallpapers folder

# Wallpaper always stretched
echo "Stretch" > /root/.config/wallpaper/backgroundmode

while true; do
  sleep $INTERVAL
  WALLPAPER=`ls "$PIX_PATH" | sort -R | head -1`
  set_bg "$PIX_PATH/$WALLPAPER"

# Restart wbar, if already running
[ `pidof wbar` ] && killall wbar && wbar &

done
Note: there's a problem when reloading/refreshing wbar-2.2.2 - if there's a window over it during refresh, some junk will be "stamped" on wbar. :(

But:

Some time ago I took wbar-2.2.2 from Saluki repo (due to nice icons) and replaced the main binaries with those from the latest wbar_2.3.0-1 and wbar-config_2.3.0-1 deb files (due to fixed 'bottom-right location' bug) and I just now realized that the above issue ("stamping") no longer exists (at least in Lupu)! :D

If anyone's interested, I've attached the .pet.
Works out-of-the-box in latest Lucid.
In other pups libImlib2 most likely should be installed.

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

Random Wallpaper Changer

#10 Post by SFR »

Ok, I knew it was going to end up like that; I just couldn't resist to "GtkDialog'ize" it.

I tried to make this app as "foolproof" as possible, and hope it will work well for others too.

Works in latest Lupu + briefly tested in Slacko and Wary.

UPDATE 2012-05-06: v1.1 - few bugfixes
UPDATE 2012-05-06: v1.2 - better handling of special characters in filenames
________________________

EDIT: The lastest version (RWC-1.6.5) is attached >>>HERE<<<.

Greetings!
Attachments
RWC-1.2.pet
Random Wallpaper Changer v1.2
(2.51 KiB) Downloaded 1382 times
RWC_v1.0.png
(21.35 KiB) Downloaded 4474 times
Last edited by SFR on Tue 20 Nov 2012, 13:09, edited 10 times in total.
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#11 Post by SFR »

I have found a bug, which, in the long run, could result in decreasing free memory (due to growing /tmp/xerrs.log file),
especially when using RWC and Pwidgets together.
Fixed now. Attachment in the previous post has been updated.

Note: pictures with spaces in filenames won't be displayed.

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

Jim1911
Posts: 2460
Joined: Mon 19 May 2008, 20:39
Location: Texas, USA

#12 Post by Jim1911 »

Thanks for the updates, however there is a minor problem running it on Slacko. Time is set for 1 minute, however, after a minute the wallpaper changes properly, followed by another change about 1 second later. So for some reason time alternates between minutes and seconds.

Changed time to 2 minutes, error was not present. Switched back to 1 minute, error did not repeat, so it's just one of those random occurrences. :oops:

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#13 Post by SFR »

Hey Jim, thanks for the feedback.
Has that problem occurred in v1.0?
I'm guessing that previous bug could cause such behaviour, but haven't encountered it when testing in Slacko...
Anyway, I'm glad it's fine now. :)
If there's anything else causing any problems, feel free to let me know.

Ok, spaces in filenames are allowed now, the attachment above has been updated, again.
Phew, such a tiny app, and so many things to take care of - hope it's the last fix. :lol:

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

Jim1911
Posts: 2460
Joined: Mon 19 May 2008, 20:39
Location: Texas, USA

#14 Post by Jim1911 »

SFR wrote:Some time ago I took wbar-2.2.2 from Saluki repo (due to nice icons) and replaced the main binaries with those from the latest wbar_2.3.0-1 and wbar-config_2.3.0-1 deb files (due to fixed 'bottom-right location' bug) and I just now realized that the above issue ("stamping") no longer exists (at least in Lupu)! :D

If anyone's interested, I've attached the .pet.
Works out-of-the-box in latest Lucid.
In other pups libImlib2 most likely should be installed.

Greetings!
Thank you, it's working great in Slacko. :D

Jim1911
Posts: 2460
Joined: Mon 19 May 2008, 20:39
Location: Texas, USA

#15 Post by Jim1911 »

SFR wrote:Hey Jim, thanks for the feedback.
Has that problem occurred in v1.0?
I'm guessing that previous bug could cause such behaviour, but haven't encountered it when testing in Slacko...
Anyway, I'm glad it's fine now. :)
If there's anything else causing any problems, feel free to let me know.

Ok, spaces in filenames are allowed now, the attachment above has been updated, again.
Phew, such a tiny app, and so many things to take care of - hope it's the last fix. :lol:

Greetings!
v. 1.1, I see that 1.2 is available now. It's hard to keep up with your updates. :D

User avatar
Eathray
Posts: 723
Joined: Sun 06 Sep 2009, 19:42

#16 Post by Eathray »

SFR,

This wallpaper switcher pet is fantastic!

Could I request a pet version for xfce on Lucid 525? That's lucid with the older kernel, in case anyone doesn't know.

Would be great to have this in xfce!

Thanks

Eathray

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#17 Post by SFR »

Thanks Eathray! :)

Here it is, briefly tested in Saluki-022 and Lupu-528 + XFCE-4.4.6.2 (from the repo).
Hope it will work in your Puppy, too.

Note: In Lupu, right after loading XFCE for the first time, I had to change wallpaper manually at first (via 'Desktop Settings'), and only after that the app started to work correctly.
I don't know why's that..?

Anyway, just let me know if everything's all right for sure.

Greetings!
Attachments
RWC_XFCE-1.2.pet
For use only with XFCE!
(2.35 KiB) Downloaded 785 times
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
Eathray
Posts: 723
Joined: Sun 06 Sep 2009, 19:42

#18 Post by Eathray »

SFR,

Smokin' man! Worked out of the box.

Thanks. I did not expect such a quick response, either. Cool.

Can I ask, how would I go about setting this up to automatically launch on start up? Any thoughts?

Thanks again. Works fantastic.

Eathray

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#19 Post by SFR »

I'm glad it's ok.

When you press "Start" button, shortcut in the /root/Startup directory is created, to launch the app at system start.
And, adequately, pressing "Stop" removes the shortcut.

It doesn't work for you?

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
Eathray
Posts: 723
Joined: Sun 06 Sep 2009, 19:42

#20 Post by Eathray »

SFR,

Hmm... I don't know :oops: I've just been sitting here watching your awesome creation, and I haven't rebooted :lol:

I'll reboot now and see if it auto launches 8)

Thanks

Eathray

Post Reply