Page 1 of 5

Easy to use random wallpaper changer

Posted: Mon 23 Apr 2012, 23:25
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

Posted: Tue 24 Apr 2012, 22:11
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!

Posted: Tue 24 Apr 2012, 22:20
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.

Posted: Tue 24 Apr 2012, 22:29
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!

Posted: Wed 25 Apr 2012, 01:41
by rmcellig
Thanks!

Posted: Wed 25 Apr 2012, 03:33
by Lobster
Now part of Puppy Hacker School code
http://puppylinux.org/wikka/PuppySchoolProgramming

Puppy Linux
Solutions for penguins

Posted: Sun 29 Apr 2012, 22:39
by Jim1911
Thank you SFR! :D

Thanks SFR & 2 comments

Posted: Thu 03 May 2012, 19:19
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

Posted: Thu 03 May 2012, 22:33
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!

Random Wallpaper Changer

Posted: Sat 05 May 2012, 16:38
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!

Posted: Sun 06 May 2012, 11:58
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!

Posted: Sun 06 May 2012, 12:54
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:

Posted: Sun 06 May 2012, 18:10
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!

Posted: Sun 06 May 2012, 18:26
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

Posted: Sun 06 May 2012, 18:30
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

Posted: Tue 05 Jun 2012, 19:37
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

Posted: Tue 05 Jun 2012, 22:04
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!

Posted: Tue 05 Jun 2012, 22:56
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

Posted: Tue 05 Jun 2012, 23:17
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!

Posted: Tue 05 Jun 2012, 23:26
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