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.

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

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?

#21 Post by L18L »

sunburnt wrote:I cannot figure out what the 2 <env: tag lines do.
Why are 2 URLs needed to set new Rox wallpaper.?
http://en.wikipedia.org/wiki/XML_namespace

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

#22 Post by musher0 »

Please see below for latest version. musher0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hello!

I think I have something...

This script will
* sort your (long) list of images alphabetically. I'm probably not the only one to have over
100 background choices! :)

* create submenus from the list above to avoid screen overflow

* offer you to
  • view
    edit or
    place the backdrop
This follows a logical sequence: we view the picture to evaluate if it will make a nice background, then we
sometimes adjust (edit) it to our needs, and when we are satisfied with our modified picture, we do the
"placing" itself.

* it is bilingual (French-English). If you do not have LANG=fr_something, it will show in English. Don't
worry about the French in the examples, the language will be English if you do not have a French
localization of your Puppy.
You can easily include other languages in the script in its "case" part. There are only a few words, so I
didn't think that a full-blown *.mo file was necessary.

* it integrates with sunburnt's earlier script. Only minor edits were needed to have the menu work in
sync with it.

* dependencies: only aemenu and ROX-Filer.

* includes a *.desktop file (BG-Setter.desktop), so it will show in the "Desktop" section of any jwm menu
(or icewm menu, etc.).

* the viewer works best with a single image viewer, such as qiv. Multiple-image viewers, such as gqview,
are not recommended because they partly duplicate what this menu does. It may confuse things.

* the menu "recurses". The cat comes back! ;) 8) Again this follows a logical process: a menu is
obviously not an application, but we want to stay with the operation until we've finished. AFAIK,
menu recursion is only possible with the "ae" menu, but I'll be glad to be proven wrong on this point,
because menu recursion is very handy at times.

Note: For the sake of simplicity, the menu / script recognizes only jpg and png images. Make sure to
rename or convert your jpeg or JPG, etc., pictures.

Constructive comments are welcome. You can edit it or improve it too, but I'd like to know about it in
this thread if possible. Thanks in advance.

Enjoy.

musher0
Attachments
change-BG-0.4.pet
(9.58 KiB) Downloaded 287 times
change_BG-0.4-2.jpg
In this picture, the list of backdrops appears sorted alphabetically, and with options of what you want to do with the picture.
(56.91 KiB) Downloaded 331 times
change_BG-0.4.jpg
If you want to change your backdrop, this is where you choose the backdrop style. You would normally want to do this beforehand.
(7.67 KiB) Downloaded 314 times
Last edited by musher0 on Tue 13 Aug 2013, 01:01, edited 2 times in total.
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.

#23 Post by sunburnt »

Hey musher0; NOTE: The xml script I got from NathanF`s wallpaper app., and he got it from somewhere else...

I looked at aemenu but can`t find any info. about the menu file format, so I couldn`t make it work
Looking at your script: BG-set4.sh gives me an idea, but no clear picture of making it work.

# I Wrote an icon menu in BaCon years ago, you may be interested in that, it auto. resizes the pics.
Format is:
(Menu Item Text):[/Path/](Exec.File):[/Path/](IconFile)

And the icon`s paths can be preset so the path isn`t needed.

### My main problem is modifying Rox`s XML code, sed will do it, but BaCon won`t.
And I don`t want a tiny script as a required dependency.
.

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

#24 Post by musher0 »

sunburnt wrote:

> Hey musher0; NOTE: The xml script I got from NathanF`s wallpaper app., and he got it from somewhere else...

It's right under everybody's nose: :P :roll: the model is in ROX Manual, Appendix C ! [url]file://localhost/usr/local/apps/ROX-Filer/Help/rox.htm#soap[/url]

PS. What do I rectify the credits to, then? Something like a folk song, then?
"sunburnt, who picked it up from Nathan F, who learned it from anonymous, who modified it from a
template by Thomas Leonard (the author of ROX-Filer)" ?

It looks ridiculous written like that, but authorship is a very serious issue.
Ideas, or experience about this, anyone ?
Last edited by musher0 on Mon 12 Aug 2013, 12:42, edited 1 time in total.
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

#25 Post by musher0 »

Hello, sunburnt.
sunburnt wrote: I looked at aemenu but can`t find any info about the menu file format, so I couldn`t make it work
Looking at your script: BG-set4.sh gives me an idea, but no clear picture of making it work.
(...)
Euh... it's a dynamic menu. You'll find the realized menu after you've run the script. Load /tmp/BG.menu in your text editor and you'll see. I mean: try it! Don't just look at it! :) (I'm not telling you what is aemenu's file format on purpose!) :) Hint: dig up aragon's work on spm (Simple Puppy Menu) on this forum.

Edit: aemenu is part of the aewm window manager, (c) 1998-2007 by Decklin Foster. Please see
http://en.wikibooks.org/wiki/Guide_to_X ... agers/aewm and http://www.red-bean.com/decklin/aewm/.
sunburnt wrote: ### My main problem is modifying Rox`s XML code, sed will do it, but BaCon won`t.
Then don't modify it! Wisdom is finding a way to live peacefully with your problem| (Pardon the philosophical bit!) BTW, replaceit or replace can be used as well.
sunburnt wrote: And I don`t want a tiny script as a required dependency.
Oh well...

Best regards.

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.

#26 Post by sunburnt »

The BaCon author pjot upgraded several of BaCon`s string replacement commands.
So now it parses XML and HTML fine!

I`m working on a custom Filer dialog for it, I`ll post the files soon...

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

#27 Post by musher0 »

sunburnt wrote:The BaCon author pjot upgraded several of BaCon`s string replacement commands.
So now it parses XML and HTML fine!

I`m working on a custom Filer dialog for it, I`ll post the files soon...
Great! Keep at it, man! :D
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

#28 Post by musher0 »

Hello again, folks!

Refined version BG-set0.5
# 13 August 2013: added "Linguistic Correction" (FR and ES);
# studied and dismissed the possibility of an integrated function (see below);
# made the script work from $MBINS.
####

# An integrated function, for ex.,
# function placefond {}
# is not advisable since it's aemenu proper which
# takes over after this script has created the menu:
# this script is inactive at time of actual menu execution.
Enjoy!

musher0
Attachments
change-BG-0.5a.pet
This one has the correct *.desktop file. Everything else is the same.
(9.86 KiB) Downloaded 259 times
BG-setter-0.5.desktop.tar.gz
If you need the *.desktop file separately... (to the person who downloaded earlier)
(351 Bytes) Downloaded 262 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Nathan F
Posts: 1764
Joined: Wed 08 Jun 2005, 14:45
Location: Wadsworth, OH (occasionally home)
Contact:

#29 Post by Nathan F »

Was poking around and found this. Thought I'd clarify - I got the idea for how to change the ROX pinboard background by reading the ROX-Filer manual, simple as that.

Also, in case people aren't aware, I've been working on an almost scratch rewrite of the old wallpaper setter I codged together years ago. Fairly nice already but I have ideas for another direction it might go. In other words it's a wip and not expected to remain stable in it's current form.
Bring on the locusts ...

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

#30 Post by sunburnt »

Good to hear Nathan.
Bounce a few of your ideas off of us for the heck of it.!

I`m working on a script to compile a BaCon file and build an AppPkg.
This so BaCon code can become portable to any compatible Linux.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#31 Post by technosaurus »

I have added basic background to my simple icon tray app (now renamed to sdesk) with the intention of (eventually) providing a full desktop for jwm (or any basic wm) that doesn't rely on rox, but it works if rox doesn't set the background... It would already be done if gtkiconview didn't do illogical crap with the background.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

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

#32 Post by sunburnt »

Ahhh... Another satisfied user of GTK ( sarcasm...).

I`ve wondered if QT is any better? I really dislike GTK.

But it`s not so much a question of that, is it.?
It`s which has more and better apps., right.?


# In regards to app. portability, static compile everything the app. uses except the kernel? :!:
.

User avatar
Nathan F
Posts: 1764
Joined: Wed 08 Jun 2005, 14:45
Location: Wadsworth, OH (occasionally home)
Contact:

#33 Post by Nathan F »

In regards to app. portability, static compile everything the app. uses except the kernel?

Code: Select all

warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
Plus other similar errors. In other words, static linking is largely broken with Glibc. Another reason to investigate Musl, or even Bionic.

That said, it's a valid approach that works *most* of the time, if you give it some love. I've had fits trying to assemble the rhyme or reason to the various incantations and spells I've had to devise to "trick" a lot of programs into compiling statically. Even went so far as to ditch gawk in favor of nawk at one point when I was trying to assemble an all static toolchain.
Bring on the locusts ...

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

#34 Post by musher0 »

Nathan F wrote:Was poking around and found this. Thought I'd clarify - I got the idea for how to change the ROX pinboard background by reading the ROX-Filer manual, simple as that.(...)
Thanks for the clarification.

Regards.

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.

#35 Post by sunburnt »

It seems that Linux is such a bag of bolts that many tricks are needed.
An assessment of apps. as to their "main stream compatibility" is a good idea.
Some package up nicely. Others are warped, so find alternative apps.

Basing a distro. on a solid parent ( Debian, Ubuntu, Slack ) is most rational.
They greatly reduce the "reinventing the wheel" mistake many keep making.
Doing all of this should be relatively simple. The methods need laying out.
.

Post Reply