Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 28 Jul 2014, 00:15
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
Random wallpaper changer for ROX-Filer
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [17 Posts]   Goto page: 1, 2 Next
Author Message
Bruce B


Joined: 18 May 2005
Posts: 11080
Location: The Peoples Republic of California

PostPosted: Sat 10 Jan 2009, 21:14    Post subject:  Random wallpaper changer for ROX-Filer
Subject description: seamless changes at defined intervals
 

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.
rwall02.zip
Description 
zip

 Download 
Filename  rwall02.zip 
Filesize  21.22 KB 
Downloaded  730 Time(s) 

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 11080
Location: The Peoples Republic of California

PostPosted: Sat 10 Jan 2009, 21:54    Post subject:  

This is the code for the "brains" rwall.
Code:

#!/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

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 11080
Location: The Peoples Republic of California

PostPosted: Sat 10 Jan 2009, 22:02    Post subject:  

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:
#!/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


_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 11080
Location: The Peoples Republic of California

PostPosted: Sat 10 Jan 2009, 22:05    Post subject:  

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:
# 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

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
CatDude


Joined: 03 Jan 2007
Posts: 1447
Location: UK

PostPosted: Sun 11 Jan 2009, 09:43    Post subject:  

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. Wink Wink


CatDude
.
wbarprob.png
 Description   
 Filesize   238.72 KB
 Viewed   3155 Time(s)

wbarprob.png

badfit.png
 Description   
 Filesize   199.7 KB
 Viewed   3155 Time(s)

badfit.png


_________________

Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 11080
Location: The Peoples Republic of California

PostPosted: Sun 11 Jan 2009, 11:48    Post subject:  

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

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
CatDude


Joined: 03 Jan 2007
Posts: 1447
Location: UK

PostPosted: Sun 11 Jan 2009, 11:54    Post subject:  

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:

#!/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
.

_________________


Last edited by CatDude on Sun 15 Jan 2012, 10:18; edited 1 time in total
Back to top
View user's profile Send private message 
bugman


Joined: 20 Dec 2005
Posts: 2131
Location: buffalo commons

PostPosted: Sun 11 Jan 2009, 20:06    Post subject:  

outstanding work!

[lazy alien]
Back to top
View user's profile Send private message Visit poster's website 
Bruce B


Joined: 18 May 2005
Posts: 11080
Location: The Peoples Republic of California

PostPosted: Mon 12 Jan 2009, 00:08    Post subject:  

@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.
rwall_tray02.zip
Description 
zip

 Download 
Filename  rwall_tray02.zip 
Filesize  4.55 KB 
Downloaded  553 Time(s) 

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 11080
Location: The Peoples Republic of California

PostPosted: Mon 12 Jan 2009, 08:46    Post subject:  

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:
#!/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?
jpg-removespaces.zip
Description 
zip

 Download 
Filename  jpg-removespaces.zip 
Filesize  795 Bytes 
Downloaded  519 Time(s) 

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 11080
Location: The Peoples Republic of California

PostPosted: Mon 12 Jan 2009, 09:27    Post subject:  

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:

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

.
gqview_setbg.zip
Description 
zip

 Download 
Filename  gqview_setbg.zip 
Filesize  921 Bytes 
Downloaded  543 Time(s) 
gqview-background-set.png
 Description   
 Filesize   17.5 KB
 Viewed   3081 Time(s)

gqview-background-set.png


_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
bugman


Joined: 20 Dec 2005
Posts: 2131
Location: buffalo commons

PostPosted: Mon 12 Jan 2009, 09:39    Post subject:  

i just put a little

Code:
#!/bin/bash
cd /root/my-applications/bin
./rwall start


in my startup folder

and i am good to go . . .
Back to top
View user's profile Send private message Visit poster's website 
HairyWill


Joined: 26 May 2006
Posts: 2949
Location: Southampton, UK

PostPosted: Mon 12 Jan 2009, 11:44    Post subject:  

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

_________________
Will
contribute: community website, screenshots, puplets, wiki, rss
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 11080
Location: The Peoples Republic of California

PostPosted: Mon 12 Jan 2009, 20:55    Post subject:  

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.

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
toomuchcomputertime


Joined: 18 Apr 2008
Posts: 171
Location: /usr/local/lib/X11/pixmaps/Cleveland\ OH\ USA.png

PostPosted: Fri 16 Apr 2010, 12:55    Post subject:  

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.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [17 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1287s ][ Queries: 13 (0.0064s) ][ GZIP on ]