Page 1 of 1
Random wallpaper changer for ROX-Filer
Posted: Sun 11 Jan 2009, 01:14
by Bruce B
Looking over another HOWTO topic on randomly
changing wallpapers, I didn't see where it made
use of ROX-Filer's ability to change wallpapers.
So, I came up with . . .
Random wallpaper changer for use with ROX-Filer
version .02 by Bruce B January 10, 2009
Name rwall stands for Rox or random, open for
suggestions for a better name.
--------------
Who is this for?
People with lots of wallpapers
also:
Lazy people with lots of wallpapers?
Aliens?
??
-------------
Features
* Randomly picks and displays wallpapers from your
collections
* Changes wallpapers at user defined intervals
* Does not copy, rename or move any files
* Seamless operation, no flickers or refreshing when
changing backgrounds
* Manages up to 1000 jpeg files in the user defined
directory
--------------
Advice
Don't get too attached to this version, because I'm working
on another version with more features.
---------------
To install
Download rwall02.zip to any directory, a temporary directory
would be best. Run these commands on the command line:
unzip rwall02.zip
./install-rwall
Optionally remove rwall02.zip
rm rwall02.zip
--------------
The installer installs theses files:
~/.rwallrc
~/my-applications/bin/rwall
~/my-applications/bin/rwall_bg
~/my-applications/bin/bg_clear.png
~/my-applications/bin/bg_nl
~/my-applications/bin/bg_sleep
----------------
About the files:
.rwallrc : user configuration, to set the jpg
directory and delay interval
rwall : the brains which instructs the engine
rwall_bg : the engine which does the work
bg_clear.png : image for clearing the background
bg_nl : gnu coreutils (original name = nl)
bg_sleep : gnucoreutils (original name = sleep)
bg_nl and bg_sleep from sysrescue cd
Puppy Linux doesn't have nl
Sleep has been renamed because the stop portion of this
program will stop it and I don't want to inadvertently
stop another "sleep" which may be running.
-----------------
Getting started
run rwall to view basic options
run rwall edit to setup your configuration file
you will want to enter the path of your jpg collection,
also the interval for randomly changing wall papers
----------------
Disclaimer: If you have ugly wallpapers it's not my
fault.
Also, if you get weird results the problem is probably
in the ~/.rwallrc file.
Later I can add lots of error checking, but for now
you must fill out the directory of your jpeg files
correctly.
Posted: Sun 11 Jan 2009, 01:54
by Bruce B
This is the code for the "brains"
rwall.
Code: Select all
#!/bin/bash
# filename rwall
BASEFN=`basename $0`
run_status()
{
RUNS=`pidof ${BASEFN}_bg`
if [ "$RUNS" != "" ] ; then
RUNS="yes"
else
RUNS="no"
fi
}
display_status()
{
if [ "$RUNS" = "no" ] ; then
echo -e "\033[31;1m Run status: ${BASEFN}_bg NOT running\033[0m"
elif [ "$RUNS" = "yes" ] ; then
echo -e "\033[31;1m Run status: ${BASEFN}_bg IS running\033[0m"
fi
}
stop_rox_bg()
{
for i in ${BASEFN}_bg bg_sleep ${BASEFN}_bg bg_sleep
do
KPID=
KPID=`pidof $i`
[ "$KPID" != "" ] && kill -s 15 $KPID >/dev/null
done
for i in ${BASEFN}_bg bg_sleep
do
KPID=
KPID=`pidof $i`
[ "$KPID" != "" ] && killall $i
done
[ -f /dev/shm/jpglist ] && rm /dev/shm/jpglist
[ -f /tmp/jpglist ] && rm /tmp/jpglist
}
start_rox_bg()
{
RUNNING=`pidof ${BASEFN}_bg`
if [ "$RUNNING" != "" ] ; then
echo -n -e "\033[31;1m Run Status: ${BASEFN}_bg"
echo -e " was already running\033[0m"
exit
fi
echo -e "\033[31;1m Run Status: ${BASEFN}_bg started\033[0m"
${BASEFN}_bg &
}
clear_wallpaper()
{
stop_rox_bg
${BASEFN}_bg clear
stop_rox_bg
run_status
display_status
}
help_rox_bg() {
printf "
Usage examples for \"$BASEFN\"
$BASEFN : displays run status
$BASEFN clear : clears background to ROX-Filer default color
$BASEFN edit : to edit personal preferences file
$BASEFN start : starts random wallpaper displays
$BASEFN stop : stops at current wallpaper ; also stops program
"
}
edit_rox_bg()
{
$DEFAULTTEXTEDITOR ~/.${BASEFN}rc &
}
short_help()
{
echo " Usage: $BASEFN < clear | edit | start | stop | --help >"
}
case $1 in
clear) clear_wallpaper ;;
edit) edit_rox_bg ;;
stop) stop_rox_bg ; run_status ; display_status ;;
start) start_rox_bg ;;
-h) help_rox_bg ;;
--help) help_rox_bg ;;
*) run_status ; display_status ; short_help
;;
esac
Posted: Sun 11 Jan 2009, 02:02
by Bruce B
Code for
rwall_bg, the engine, so to speak, which stays resident, handling the wallpaper changes.
Once a few tasks are accomplished, the
while loop is what mainly manages things.
Code: Select all
#!/bin/bash
# filename rwall_bg
BASEDIR=`dirname $0`
if [ "$1" = "clear" ] ; then
set_bg ${BASEDIR}/bg_clear.png >/dev/null
exit
fi
BASEFN=`basename $0 | sed "s/_bg//g"`
JPGDIR=`grep ^JPGDIR= ~/.${BASEFN}rc | sed "s/\"/ /g" | cut -d " " -f 2`
INTERVAL=`grep ^INTERVAL= ~/.${BASEFN}rc | sed "s/\"/ /g" | cut -d " " -f 2`
LISTDIR=/tmp
grep /dev/shm /proc/mounts>/dev/null && LISTDIR=/dev/shm
set_bg()
{
rox --RPC << EOF
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
<env:Body xmlns="http://rox.sourceforge.net/SOAP/ROX-Filer">
<SetBackdrop>
<Filename>$1</Filename>
<Style>Centre</Style>
</SetBackdrop>
</env:Body>
</env:Envelope>
EOF
}
one_space()
{
while read f
do
echo $f
done
}
ls -1 ${JPGDIR}/*.jpg >${LISTDIR}/jpglist~
<${LISTDIR}/jpglist~ bg_nl -n ln | one_space>${LISTDIR}/jpglist
TOTAL=`grep -c . ${LISTDIR}/jpglist`
[ -f ${LISTDIR}/jpglist~ ] && rm ${LISTDIR}/jpglist~
while :
do
let NUM=${RANDOM}%1000+1
if [ "$NUM" -le "$TOTAL" ] ; then
BACKGROUND=`grep "$NUM " ${LISTDIR}/jpglist | cut -d " " -f 2`
set_bg $BACKGROUND
bg_sleep $INTERVAL
fi
done
Posted: Sun 11 Jan 2009, 02:05
by Bruce B
The only file which needs editing and it does need it by the users. File is
~/.rwallrc
The function to open ~/.rwallrc in the default editor is included in
rwall
Otherwise is this understandable enough? Does it need to be more clear?
Code: Select all
# Important: maintain quoting in your variable data
# You can save old data with # comments as in examples below
#JPGDIR="/initrd/mnt/dev_save/jpg_in" # don't use trailing backslashes
#INTERVAL="5000" # in seconds, integers only are allowed
JPGDIR="/usr/share/backgrounds" # don't use trailing backslashes
INTERVAL="60" # in seconds, integers only are allowed
Posted: Sun 11 Jan 2009, 13:43
by CatDude
Hello Bruce
I thought i would give this a try.
It seems to work OK, but
if one is running wbar, as i am (i run it invisable, just in case you are wondering where the icons are)
there is a rectangle where the wbar sits, and it requires a right click on the wbar to correct things. (see: wbarprob.png)
Also if your wallpaper images are of different sizes, it would be nice if they could be Stretched to fit. (see: badfit.png)
My desktop is running at: 1280x960
The image being displayed in: wbarprob.png is 1280x960
The image being displayed in: badfit.png is 1024x768
Bruce B wrote:
Don't get too attached to this version, because I'm working
on another version with more features.
Maybe you are already looking at the issues i speak of, in this new version,
if not, then maybe you could.
CatDude
.
Posted: Sun 11 Jan 2009, 15:48
by Bruce B
CatDude,
Thanks for the feedback. Stretched is one of ROX's SOAP options. I don't know how it is spelled, maybe I can find out or trial and error.
Notice center is spelled Centre
Stretching would be good, but a couple, just a couple mind you, of my backgrounds are scantly clothed ladies. Stretching a nicely rounded lady, makes her not so nicely rounded.
I noticed on one of your pics, you have ROX-Filer's default background color of gray. You can set this color to a more attractive color and the centered images will look better.
There certainly could be a .rwallrc option for centered or stretched. After I learn how ROX-Filer SOAP script wants stretch spelled, I'll add that option.
If you learn, let me know.
Today's update, Lord willing, will be a taskbar controlled icon to make running it more simple for some. It's made, tested and works good. Just need to write up the documentation and post it.
1st click - starts the background displaying
2nd click - stops at the current image
3rd click - clears the backdrop to ROX user defined color, or the default if the user didn't define one.
And round you go. Very simple, fast moving and practical, IMO.
Bruce
Posted: Sun 11 Jan 2009, 15:54
by CatDude
Hello Bruce B
Sorry but i could not resist having a hack at your code. (please forgive me)
I managed to sort out both of the issues i pointed out above.
First of all, i installed:
xevent-0.1-i486.pet
as provided by: 01micko
here
Then i changed your
rwall_bg
to look like this:
Code: Select all
#!/bin/bash
# filename rwall_bg
BASEDIR=`dirname $0`
if [ "$1" = "clear" ] ; then
set_bg ${BASEDIR}/bg_clear.png >/dev/null
exit
fi
BASEFN=`basename $0 | sed "s/_bg//g"`
JPGDIR=`grep ^JPGDIR= ~/.${BASEFN}rc | sed "s/\"/ /g" | cut -d " " -f 2`
INTERVAL=`grep ^INTERVAL= ~/.${BASEFN}rc | sed "s/\"/ /g" | cut -d " " -f 2`
LISTDIR=/tmp
grep /dev/shm /proc/mounts>/dev/null && LISTDIR=/dev/shm
##### the following line was added by CatDude. (Taken from: /usr/local/apps/System/Wallpaper/set_bg)
MODE="`cat $HOME/.config/tmp/backgroundmode`"
set_bg()
{
##### Also i changed: <Style>Centre</Style> to <Style>$MODE</Style>
rox --RPC << EOF
<?xml version="1.0"?>
<env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
<env:Body xmlns="http://rox.sourceforge.net/SOAP/ROX-Filer">
<SetBackdrop>
<Filename>$1</Filename>
<Style>$MODE</Style>
</SetBackdrop>
</env:Body>
</env:Envelope>
EOF
}
one_space()
{
while read f
do
echo $f
done
}
ls -1 ${JPGDIR}/*.jpg >${LISTDIR}/jpglist~
<${LISTDIR}/jpglist~ bg_nl -n ln | one_space>${LISTDIR}/jpglist
TOTAL=`grep -c . ${LISTDIR}/jpglist`
[ -f ${LISTDIR}/jpglist~ ] && rm ${LISTDIR}/jpglist~
while :
do
let NUM=${RANDOM}%1000+1
if [ "$NUM" -le "$TOTAL" ] ; then
BACKGROUND=`grep "$NUM " ${LISTDIR}/jpglist | cut -d " " -f 2`
set_bg $BACKGROUND
##### the following 3 lines were added by CatDude.
xevent -a 280 860 #number of pixels for cursor to deviate right and down
sleep 0.2 ; xevent -b 3 #simulated right mouse click
sleep 0.1 ; xevent -a 280 860
bg_sleep $INTERVAL
fi
done
The position i used for the xevent,
was arrived at by taking a screenshot of the desktop (showing the rectangle where wbar should be)
then moving the cursor over the screenshot to the top lefthand corner of the rectangle,
and making a note of the position. (Very crude, but only needs doing once)
Anyway, i am sure someone with your abilities can do a better job of it.
CatDude
.
Posted: Mon 12 Jan 2009, 00:06
by bugman
outstanding work!
[lazy alien]
Posted: Mon 12 Jan 2009, 04:08
by Bruce B
@CatDude,
Thanks, I'll work on adding modes for version 03.
@Aliens et al
Attached is version 02 taskbar controller, single click options:
- start bg
stop bg with current bg
clear bg
Installation instructions:
Download to temporary directory
unzip rwall_tray02.zip
./install-tasktray
Optionally
rm rwall_tray02.zip
It's mostly automated, but you will have to copy and paste one line.
Posted: Mon 12 Jan 2009, 12:46
by Bruce B
There is a problem when 'rwall' encounters a file name with spaces. If you have pictures with spaces in the file name, let me know and I'll upload the fix for you.
You can also remove the spaces. I wrote a utility to do this. As follows:
Code: Select all
#!/bin/bash
show_help()
{
FNAME=`basename $0`
printf "
Welcome to $FNAME
Utility purpose is to replace spaces with underscores
on files with .jpg extension.
In order to avoid any unintentional or unwanted file
renaming, it works only on .jpg files and only in
the current directory.
To use, type: $FNAME -go
"
}
fix_lines()
{
while read f
do
x=`echo $f | sed "s/ /_/g"`
if [ "$f" != "$x" ] ; then
echo mv \"$f\" $x>>spaces_to_underscore_tmp.sh
fi
done
}
if [ "$1" = "-go" ] ; then
echo "#!/bin/bash">underscore_to_spaces_tmp.sh
ls -1 $PWD/*.jpg | fix_lines
chmod 755 spaces_to_underscore_tmp.sh
./spaces_to_underscore_tmp.sh
rm spaces_to_underscore_tmp.sh
echo Done
else
show_help
fi
In install, download jpg-removespaces.zip, then
unzip jpg-removespaces.zip
./install.sh
(places jpg-removespaces script in /root/my-applications/bin)
If you want to remove the zip package:
rm jpg-removespaces.zip
Anyone want a utility to convert
File_Name.jpg to lowercase?
Posted: Mon 12 Jan 2009, 13:27
by Bruce B
For selecting backgrounds manually from big collections, I've found GQview is excellent.
Find a background you like then use the menu or keyboard to set the background.
---------------
I've attached two files to allow you do to this with ROX-Filer
----------------
To install files
The standard procedure, download, unzip, then;
./install.sh
---------------
To setup GQview; Edit -> Preferences -> Editors tab
There are two columns
Code: Select all
Menu Name Command Line
ROX-Filer Centre gqview_center %f
ROX-Filer Stretch gqview_stretch %f
See picture for how it looks when setup
Download package is attached
.
Posted: Mon 12 Jan 2009, 13:39
by bugman
i just put a little
Code: Select all
#!/bin/bash
cd /root/my-applications/bin
./rwall start
in my startup folder
and i am good to go . . .
Posted: Mon 12 Jan 2009, 15:44
by HairyWill
Bruce B wrote:For selecting backgrounds manually from big collections, I've found GQview is excellent.
Find a background you like then use the menu or keyboard to set the background.
roxrightclicks can now be used to set an image as the desktop background directly from a roxfiler window. You need at least wallpaper-0.5.1.
Here is a screenshot in spanish
Posted: Tue 13 Jan 2009, 00:55
by Bruce B
Cool stuff Will.
Sort of wish people would take the time to explore the potential of our light weight ROX desktop and file manager and JWM, before thinking they need a heavy weight.
Version 4.x JWM looks great as is, but with more work, it is very configurable to a variety of tastes. I'd take the JWM / ROX-Filer / Midnight Commander combination any day over what the proprietor thinks he has to offer. Actually, over a lot of FOSS desktop / filemanger combinations.
Now being American, I'm proud to have a second language, which is C, no just kidding, it's Spanish. This brings me to the question: Where's the screenshot?
Bruce
Plus - I'm busy at work making version 03, it should be really great. I'm particularly pleased about how ROX-Filer changes backgrounds without so much as a flicker.
Posted: Fri 16 Apr 2010, 16:55
by toomuchcomputertime
Thanks, I am trying to figure out how to make it fixwidgets (pwidgets) after changing the background?
Thanks. Also, I saw Catdude working with wbar, which I also use.
Thanks.
Posted: Wed 22 Sep 2010, 19:11
by walter90
Is there a way you could tweak the script so we could choose a sequential wallpaper rotation? Say number our walls and have them display in that order?
Other than that I am very happy with this!
Posted: Sat 24 Aug 2013, 23:41
by oldyeller
Hi Bruce,
I have enjoyed using this, So I hope you don't mind that I did gui for this, it is very basic and probably could use some improvements to it.
Directory is inaccessible
Posted: Thu 29 Jun 2017, 18:38
by rocker1440
Hello, new to whole linux stuff.
Had a old laptop so installed puppy linux without failing somehow,
First package I got was rwall and I installed it from the urxvt(command thing)
when I type "rwall start" it says : #ls cannot access <directory> no such file or directory.
Help me please.
Edit: the version is slacko .6.3.0
Posted: Fri 30 Jun 2017, 18:17
by souleau
Let's first check if rwall is in ~/my-applications/bin/
So go to the ROX-filer File Manager, and once the window listing the folders in ~ opens, click on the my-applications folder, then click on the bin folder and check if rwall is present.
If it is, I want you to do the following. Right-click in the Rox window, an option menu opens. In that option menu, go to -Window-, then scroll down to where it says -Terminal Here-.
This opens urxvt in the ~/my-applications/bin folder, so we're pretty sure it will find rwall now.
Now type "rwall start" and see what happens.
Report result if succesful or if you get an error message.
Posted: Sun 21 Jan 2018, 02:45
by TwoPuppies
toomuchcomputertime wrote:Thanks, I am trying to figure out how to make it fixwidgets (pwidgets) after changing the background?
I know this is a really old post, but I was wondering how to do this too. The solution seems to be to insert
fixwidgets between the 3rd and 4th last lines of the
rwall_bg script, like this...
Code: Select all
while :
do
let NUM=${RANDOM}%1000+1
if [ "$NUM" -le "$TOTAL" ] ; then
BACKGROUND=`grep "$NUM " ${LISTDIR}/jpglist | cut -d " " -f 2`
set_bg $BACKGROUND
fixwidgets
bg_sleep $INTERVAL
fi
done