Is there another way to set wallpaper for the Rox desktop?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

Is there another way to set wallpaper for the Rox desktop?

#1 Post by sunburnt »

This sets the wallpaper by restarting the desktop, but doesn`t do stretch, tile, etc.:

Code: Select all

rox -p /root/Choices/ROX-Filer/PuppyPin
This XML code does it, but it`s a real pain to use it directly in other languages.

Code: Select all

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
I cannot figure out what the 2 <env: tag lines do.
Why are 2 URLs needed to set new Rox wallpaper.?

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#2 Post by musher0 »

Hi.

Ah, I see you read the Appendix to the ROX manual! :)

Add this before the above code, and you'll get a centered background by right-clicking on the picture.

Code: Select all

#!/bin/sh
####

IFS='\n'
MODE="Centre"
echo $MODE > $HOME/.config/wallpaper/backgroundmode

(code in previous post goes here)
Change the MODE to "Scale" and you'll get a scaled background.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#3 Post by sunburnt »

Thanks musher0; I`m hoping to find another way to do it other than XML.

The Center mode does not seem to work.

I modded the code to use cli args. for both /path/file and mode:

Code: Select all

#!/bin/sh

[ "$2" = "Center" ] && MODE="Centre"

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>$2</Style>
  </SetBackdrop>
 </env:Body>
</env:Envelope>

EOF

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#4 Post by musher0 »

Hello, people!

For those who don't want to code anything, of course, there is always the longish way to do it.

First, un-tick the second item in the Options Compatibility list (see 1st pic).
Your window manager menu will be temporarily disabled.

Second, choose "backdrop" in ROX's right-click list.
Drag your picture in the box. (See 2nd pic.) Your new background
will place itself on the desktop automatically.

Finally, go back to ROX's Options panel, go to "Compatibility" tab, and re-tick the second item. A right-click on the background will now call your window manager menu, like previously.

It takes longer, but of course you're not supposed to change backgrounds every other minute.

Sorry for the French in the pictures. On an English system, the items' labels will be in English. Just follow the positions.

I hope this helps.

BFN.

musher0
Attachments
Untick_Second_Item.jpg
(30.81 KiB) Downloaded 592 times
Another_Way_to_Set_ROX_Background.jpg
(42.97 KiB) Downloaded 692 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

Re: Is there another way to set wallpaper for the Rox desktop?

#5 Post by Karl Godt »

sunburnt wrote: Why are 2 URLs needed to set new Rox wallpaper.?
The Author on his way to world domination,
needs a backdoor URL to make ROX popup an icon to the USER to say "$USER , Pay 10,000$ or I'll nuke your partition table !"
:lol:

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#6 Post by musher0 »

Hi, sunburnt.

I played around with your script and made it work with the following changes:

1) Try prefixing the image name with $PWD/. Something like

Code: Select all

sunburntBG.sh $PWD/wallpaper-snow.jpg Centre
2) Also stick to the American English spelling of "Centre", not the British
one of "Center", or a mix of the two. Neither ROX nor bash know how to
spell! It seems that ROX uses the American spelling, so there is no point
in providing both spellings.

So here's your script again, edited:

Code: Select all

#!/bin/sh
# /root/my-applications/bin/sunburntBG.sh
#
[ "$2" = "Centre" ] && MODE="Centre" 
echo $MODE > $HOME/.config/wallpaper/backgroundmode

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
3) As a precaution, I've added the line:

Code: Select all

echo $MODE > $HOME/.config/wallpaper/backgroundmode
as you can see.

4) As well, I did away with the $2 variable and substituted $MODE, which
you provide at the beginning of your script: I think it's clearer with $MODE.

Now your script works for me! :)

Best.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

Re: Is there another way to set wallpaper for the Rox desktop?

#7 Post by musher0 »

Karl Godt wrote:
sunburnt wrote: Why are 2 URLs needed to set new Rox wallpaper.?
The Author on his way to world domination,
needs a backdoor URL to make ROX popup an icon to the USER to say "$USER , Pay 10,000$ or I'll nuke your partition table !"
:lol:
Funny guy... :)

Hint :wink: : make a backup of your fstab if you know Karl_Godt is going
to be around! (And of everything in your Puppy, while you're at it!) :P

I hope the smileys are showing properly at your end?! :lol: 8)
(This is a joke!)

Have fun!
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#8 Post by sunburnt »

Thanks again musher0; This is being run from a BaCon app.
So it`s easiest to just feed script with cli arguments.
But for compatibility I also write the config. files in the BaCon app.

So actually the line should be: [ "$2" = "Center" ] && MODE="Centre"
But if I`m using cli args., then I`ll need to fix it in the BaCon app.

This seems to get all of the modes working; Stretch, Center, Tile, Scale.
.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#9 Post by musher0 »

Hello, again, sunburnt.

I don't know BaCon (except with eggs... or in a BLT sandwich) :)
So can't help you there!

That said, with a direct cli,
line 12 of the script could have this:

Code: Select all

   <Filename>$PWD/$1</Filename> 
and one could use this simpler command instead:

Code: Select all

sunburntBG.sh wallpaper-west.jpg Centre
Speaking of BLT sandwich, I'm hungry! :)

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

R-S-H
Posts: 487
Joined: Mon 18 Feb 2013, 12:47

#10 Post by R-S-H »

To scripts to set Wallpaper from Openbox menu by stu90
I think (just hope so), the setwalle script can be used also to set specific wallpaper (setwalle YourWPHere) from within any other WM.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy Home
The new LazY Puppy Information Centre[/url][/b]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#11 Post by musher0 »

Hello, R-S-H.

That sure is a nice script from stu90. However, it is no good with ROX,
since ROX adds its own wallpaper layer.

Stu's script also needs feh as a dependency, which like qiv and a couple
of other background apps, set the second layer of background (the one
that conky sees when in transparent mode).

The first layer of background being set by BK's .xinitrc with this line:

Code: Select all

[ -f /usr/bin/xsetroot ] && xsetroot -cursor_name top_left_arrow
through xsetroot (line 103 or thereabouts). It should be noted that
one cannot set a jpeg or png image as background with xsetroot,
only a xpm pattern. (That's a pretty old approach, if you ask me.)
But xsetroot is needed to define the cursor.

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#12 Post by sunburnt »

Yeah, I`m guessing that only Rox does Rox.

So I`ll try to make the best of this...

R-S-H
Posts: 487
Joined: Mon 18 Feb 2013, 12:47

#13 Post by R-S-H »

Hi.
musher0 wrote:That sure is a nice script from stu90. However, it is no good with ROX,
since ROX adds its own wallpaper layer.

Stu's script also needs feh as a dependency, which like qiv and a couple
of other background apps, set the second layer of background (the one
that conky sees when in transparent mode).
I don't know if there are some apps and/or dependencies needed (like feh and qiv). All I do know, is:

1. I do use this nearly daily, by now, for about one year or so, without any problems
2. I don't have feh installed (see the attached image)
3. I don't have qiv installed (see the attached image)
4. File Manager is ROX

And it works very well over here.

I did just made some modifications to refresh the PWidgets and WBar (because of them used background-parts).
It should be noted that
one cannot set a jpeg or png image as background with xsetroot,
only a xpm pattern. (That's a pretty old approach, if you ask me.)
But xsetroot is needed to define the cursor.
As you can see in the third image:

I do use JPG files for wallpapers. PNG works also, but I did choose to use JPG only, because of its size.

This is no offend!

These are just the facts - over here, in LazY Puppy, based on Lucid 528-4!

RSH
Attachments
image-1.jpg
There is no qiv installed
(13.58 KiB) Downloaded 516 times
image-3.jpg
There is no feh installed
(18 KiB) Downloaded 570 times
image-4.jpg
JPG Images from /usr/share/backgrounds in Openbox menu
(128.94 KiB) Downloaded 493 times
[b][url=http://lazy-puppy.weebly.com]LazY Puppy Home
The new LazY Puppy Information Centre[/url][/b]

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: Is there another way to set wallpaper for the Rox desktop?

#14 Post by L18L »

use sed -i to change style and image in the backdrop line
ex:

Code: Select all

<backdrop style="Stretched">/usr/share/backgrounds/squiggles.jpg</backdrop>
and relaunch rox -p
(that is what setwalle does and what GUI pwallpaper does)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#15 Post by musher0 »

My apologies, R-S-H and L18L.

I had focused on the rem'd feh part (it is thus only an option), and the following had escaped me.

Code: Select all

### apply new wallpaper for rox-filer ###
     currentwall="`awk -F"[<,>]" '/<pinboard/ { getline; print $3 }' $HOME/Choices/ROX-Filer/PuppyPin`"
     sed -i "s:$currentwall:$WALL:g" /root/Choices/ROX-Filer/PuppyPin
     echo $WALL > $HOME/.config/wallpaper/bg_img
     rox --pinboard=/root/Choices/ROX-Filer/PuppyPin
As a note, the use of replaceit would probably make things easier than the use of sed, for the non specialist.

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#16 Post by sunburnt »

I had discounted using PuppyPin, but I guess it is a hell of a lot easier.

I`ll rework WallPuppy one more time.

User avatar
stu91
Posts: 145
Joined: Mon 06 Aug 2012, 15:11
Location: England. Dpup. Dell Inspiron 1501

#17 Post by stu91 »

This has been my default rox wallpaper changer for a while now - maybe of some use?

Code: Select all

#!/bin/sh
IFS=$'\n'
########################################################################
   if [[ ! -f $HOME/.twall ]]; then
   echo "DIR=/usr/share/backgrounds" >> $HOME/.twall
   echo "FORMAT=Stretch" >> $HOME/.twall    
   fi

   WALLDIR="` grep -i "DIR" $HOME/.twall | cut -d '=' -f2 `"
   FORMAT="` grep -i "FORMAT" $HOME/.twall | cut -d '=' -f2 `"

########################################################################  
function WALLPAPER () {  
   echo ":: Current Wallpaper   > `cat $HOME/.config/wallpaper/bg_img` "
   echo ":: Current Directory   > $WALLDIR"
   echo ":: Current Format      > $FORMAT"
   select WALL in ` ls -1 "$WALLDIR/" | egrep ".jpg$|.png$" | sort ` "Quit" ; 
   do 
   
   if [[ "$WALL" = "Quit" ]]; then 
   echo "Goodbye...." && exit 
  
   elif [ ! -n "$WALL" ]; then
   echo "not a wallpaper....."
   #echo "Applying wallpaper - $WALLDIR/$WALL"
   else
   
   clear
   echo "Selected and applying > $WALL"
   
  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>$WALLDIR/$WALL</Filename>
   <Style>$FORMAT</Style>
  </SetBackdrop>
 </env:Body>
</env:Envelope>

EOF
   echo "$WALLDIR/$WALL" > $HOME/.config/wallpaper/bg_img
   fi
   
  ## no icons puppy pin ##
 NOIWALL=`awk -F"[<,>]" '/<pinboard/ { getline; print $3 }' $HOME/Choices/ROX-Filer/noicon`
 sed -i "s:$NOIWALL:$WALLDIR/$WALL:g" /root/Choices/ROX-Filer/noicon
 
 #echo "Desktop Wallpaper > "$WALLDIR/$WALL" " | osd_cat -p "top"  -f "sans 15" -c "white" -d "8" -l "1" - &
 [[ -x "/usr/bin/notify-send" ]] && notify-send -t 5000 "Wallpaper > "$WALLDIR/$WALL" "
   
   done
}   

function HELP () {
	echo " :: Puppy Terminal wallpaper changer ::"
    echo " select the wallpaper to apply by number and press enter "
    echo " leave the input field blank and press enter to redraw list "
    echo ""
    echo "       -d  To change the current wallpaper directory"
    echo "       -f  To change  the wallpaper layout / format"
    echo "       -h  For help" 
}	
########################################################################
    clear
   
    if [[ $# = 0 ]]; then
    WALLPAPER
    
    elif [[ $1 = -d ]]; then 
    echo "Current Dir - $WALLDIR"
    read -p "Enter new wallpaper Directory: " NEWWALLDIR 
    sed -i "s:"$WALLDIR":"$NEWWALLDIR":g" $HOME/.twall && exit
    
    elif [[ $1 = -h ]]; then 
    HELP
    
    elif [[ $1 = -f ]]; then 
    echo "Current Format - $FORMAT"
    echo "Enter new wallpaper Format:"
    select NEWFORMAT in "Stretch" "Scale" "Tile" "Center" "Quit" ; do
    
     if [[ "$NEWFORMAT" = "Quit" ]]; then 
     echo "Goodbye...." && exit
     
     elif [[ -n "$NEWFORMAT" ]]; then
     sed -i "s:"$FORMAT":"$NEWFORMAT":g" $HOME/.twall && exit
     else
     echo "not a format...."
     fi 
    
    done 
    fi

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#18 Post by sunburnt »

Hi stu91; Others here were talking about your script. so I downloaded it.
But the gzip file was corrupt, probably just a bad download, crap happens...

I`ll look at your code further, WallPuppy was a doodle to show NathanF.

Thanks for being a Puppy member.! Terry

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: Is there another way to set wallpaper for the Rox desktop?

#19 Post by L18L »

L18L wrote:... rox -p
(that is what setwalle does and what GUI pwallpaper does)
Apologies for having shot too fast :oops:

rox -p .... is one way

but the other is different

pwallpaper (see http://bkhome.org/blog2/?viewDetailed=00181)
has a function setBG which is immediately showing the new background-image.

I don't understand how it works but here it is:

Code: Select all

void setBG()
{
	
	FILE *file;
	gchar command[2500];
	g_print(_("Using the program %s.\n"), program);
	strcpy(command, "");
	strcpy(command, program);
	strcat(command, " ");
	switch (currentOption)
	{
		case 0:
		    file = fopen("/root/.config/wallpaper/backgroundmode","w+");
		    fprintf(file,"%s","Stretch");
		  	fclose(file); 
			break;
		case 1:
		    file = fopen("/root/.config/wallpaper/backgroundmode","w+"); 
		    fprintf(file,"%s","Centre"); 
		  	fclose(file);
			break;
		case 2:
		    file = fopen("/root/.config/wallpaper/backgroundmode","w+"); 
		    fprintf(file,"%s","Tile");
		  	fclose(file);
			break;

	}
	strcat(command, " ");
	if (filename[0] != '\0')
	{
		strcat(command, filename);
		system(command);
		remove("/root/.config/wallpaper/bg_img");
	}
	return;
}

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Is there another way to set wallpaper for the Rox desktop?

#20 Post by L18L »

L18L wrote:I don't understand how it works
Reading the sources can help also if you think to have no idea about C

Code: Select all

		strcpy(program, "/usr/sbin/set_bg");
and/or just the comments:

Code: Select all

//pwallpaper.c
//Copyright(c) 2009 G Pearson
// Puppy Wallpaper Setter
// Puppy Linux v 2-5
// 100704 BK: set_bg script now at /usr/sbin (in Woof).
// 130314 L18L internationalized v.1.2

Code: Select all

MODE="`cat $HOME/.config/wallpaper/backgroundmode`"
[ "$MODE" = "" ] && MODE="Scale"
[ "$MODE" = "Centred" ] && MODE="Centre"
[ "$MODE" = "Scaled" ] && MODE="Scale"
SOLVED?

Post Reply