Is there another way to set wallpaper for the Rox desktop?
hi all, i want to asking a question. when i use nathan wallpaper setter, i can see my current background in /root/.config/wallpaper/bg_img. but now, i use precise 571 and there is a new pwallpaper setter v1.2. i'm confusing, where is the location of my background's file (because, after choosing a picture and apply that, the file bg_img disappear). anyone know where is the file bg_img or something comfiguration like that?
fyi, i want to change the background in a session by gtkdialog and then when i close that gtkdialog, it's come back to the background before.
thanks.
fyi, i want to change the background in a session by gtkdialog and then when i close that gtkdialog, it's come back to the background before.
thanks.
Well, for the time being, Nathan's wallpaper version 0.6.3 is still available here:sunburnt wrote:Hi recobayu; Nathan`s very nice Wallpaper app. has been taken out of a lot of the Puppy versions.
pwallpaper is pretty sad isn`t it?
It sounds like you may need to write your own wallpaper setter to do what you want.
http://distro.ibiblio.org/puppylinux/pe ... -0.6.3.pet
and here:
http://ftp.nluug.nl/os/Linux/distr/pupp ... -0.6.3.pet
Works fine on my wary 5.5, too.
BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
I found it!
and we get our current wallpaper background. Ok, thanks.
Code: Select all
cat /root/Choices/ROX-Filer/PuppyPin | grep backdrop | cut -d '>' -f2 | cut -d '<' -f1
Or...
The sed command has 2 parts, and it`s best to do the last part of the string first.
Also grep can read a file by itself, so the cat command is unneeded and wastes cpu cycles.
Code: Select all
grep backdrop /root/Choices/ROX-Filer/PuppyPin | sed 's#\</.*$##;s#^.*\>##'
Also grep can read a file by itself, so the cat command is unneeded and wastes cpu cycles.
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
faster
Reallysunburnt wrote:Or...Code: Select all
grep backdrop /root/Choices/ROX-Filer/PuppyPin | sed 's#\</.*$##;s#^.*\>##'
It is faster (only 0.024 seconds instead of 0.046 seconds on my computer)...
... but it is false
Really odd, I`ve used this code dozens of times, even the end only doesn`t work.
And I know this should work... Should take the last tag off the line.
Grep is pulling the line, but sed is doing absolutely nothing with it.!
### ODDLY; Escaping the <> is not being accepted by sed.
# This works:
Code: Select all
grep backdrop /root/Choices/ROX-Filer/PuppyPin |sed 's#\</.*$##'
<backdrop style="Stretched">/mnt/sda3/docs/pics/EndlessBlue_1680.jpg</backdrop>
Grep is pulling the line, but sed is doing absolutely nothing with it.!
### ODDLY; Escaping the <> is not being accepted by sed.
# This works:
Code: Select all
grep backdrop /root/Choices/ROX-Filer/PuppyPin | sed 's#</.*$##;s#^.*>##'
--meanwhile
parsing this:
# <backdrop style="Stretched">/usr/share/backgrounds/kandinsky_gugg_0910_24.jpg</backdrop>
Fieldseparators -literal/escaped:<>
print field 3 -the pathtowallpaper
@L18L may want to time this simple awk-command
By comparative reasoning about the snippets,cpu-cycles?:
: cat,grep,cut,cut
grep,sed
awk
Count the bytecode - in this case awk will be smallest.
ASSUME that we want the contents of the third-last field
ASSUME we want BOTH the style and the pathtowallpaper
(Its probably faster/smaller bytecode to do something like ar=($(awk.......)),and echo the wanted array-elements in production-code - instead of calling read)
Note:style-output will be unquoted f.x Stretched
To grab the style WITH quotes try this awk-command:
Note: Using \n in the printf formatting works like a sort of output-delimiter,
allowing us to extract path with spaces and other unwieldy stuff.
Awk can be used in various ways to maul,rewrite,calculate and move things around in the PuppyPin.
----
sorry guys -
life seems to pass me by while I try to post
but thanks for the attention to the sed-issue.
.@sunburnt:Thanks
grep backdrop /root/Choices/ROX-Filer/PuppyPin | sed 's#</.*$##;s#^.*>##'
WORKS at my place.
Cheers
parsing this:
# <backdrop style="Stretched">/usr/share/backgrounds/kandinsky_gugg_0910_24.jpg</backdrop>
Code: Select all
awk -F[\>\<] '/backdrop/{print $3}' /root/Choices/ROX-Filer/PuppyPin
print field 3 -the pathtowallpaper
@L18L may want to time this simple awk-command
By comparative reasoning about the snippets,cpu-cycles?:
: cat,grep,cut,cut
grep,sed
awk
Count the bytecode - in this case awk will be smallest.
ASSUME that we want the contents of the third-last field
Code: Select all
awk -F[\>\<] '/backdrop/{u=NF-2;print $u}' /root/Choices/ROX-Filer/PuppyPin
Code: Select all
read -r style pic <<<$(awk -F[\>\<\"] '/backdrop/{printf "%s\n%s",$3,$5}' /root/Choices/ROX-Filer/PuppyPin)
echo "$style"
echo "$pic"
Note:style-output will be unquoted f.x Stretched
To grab the style WITH quotes try this awk-command:
Code: Select all
awk -F[\>\<\=] '/backdrop/{printf "%s\n%s",$3,$4}' /root/Choices/ROX-Filer/PuppyPin
allowing us to extract path with spaces and other unwieldy stuff.
Awk can be used in various ways to maul,rewrite,calculate and move things around in the PuppyPin.
----
sorry guys -
life seems to pass me by while I try to post
but thanks for the attention to the sed-issue.
.@sunburnt:Thanks
grep backdrop /root/Choices/ROX-Filer/PuppyPin | sed 's#</.*$##;s#^.*>##'
WORKS at my place.
Cheers
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
Code: Select all
sed 's#what#ever#' /path/to/file
Some "bashing" also...(on behalf of technosaurus)
Probably faster than Awk but not enough to really matter.
Cheers,
s
Code: Select all
line=`grep backdrop /root/Choices/ROX-Filer/PuppyPin`
remove_end=${line/<\/backdrop>/} filename=${remove_end##*>}
Cheers,
s
seaside; Yes, I thought of that also, but it doesn`t seem to be much quicker.
I always use pure Bash when possible.
And... I don`t know why I didn`t think of this "sed all in one":
First section: "/backdrop/!d" does "grep". This does "grep -v": "sed '/backdrop/d'"
# It`s almost twice as fast as most other methods as it only calls sed once.
.
I always use pure Bash when possible.
And... I don`t know why I didn`t think of this "sed all in one":
Code: Select all
time sed '/backdrop/!d;s#</.*$##;s#^.*>##' $a
# It`s almost twice as fast as most other methods as it only calls sed once.
.
Nitpicking:
Parsing for "backdrop" may not be quite prudent:
False positive:
1.NO wallpaper set -> NO wallpaper-backdrop-directive
2.a non-directive "backdrop"-string elsewhere in PuppyPin -as part of path.iconname,wjatever
Ok -in this - lets give grep the upperhand on awk:
---
Apropos awk:
The nice script provided by Stu91 contains a way of
awk-fieldseperatorspecfication,which may be somewhat handy
in handling escape characters:
I tend to do something like this,trying to rember characters which need to be escaped.
a la Stu91:
--a method which will handle most characters as field-seperators
without the need of considering escaping.
However an escape is needed in this:
----
@seaside:Yeah - bashstringsops are speady .and very often ought to be used - instead of the usual filetools.in strings-handling.
Edit: Ok - it took half a day for me to correct my sloppy path to PuppyPin
Added:
Being at it,NO grep but read and bashops may very well be a speedier construct:
Cheers
Parsing for "backdrop" may not be quite prudent:
False positive:
1.NO wallpaper set -> NO wallpaper-backdrop-directive
2.a non-directive "backdrop"-string elsewhere in PuppyPin -as part of path.iconname,wjatever
Ok -in this - lets give grep the upperhand on awk:
Code: Select all
grep -m1 '<backdrop' /root/Choices/ROX-Filer/PuppyPin
---
Apropos awk:
The nice script provided by Stu91 contains a way of
awk-fieldseperatorspecfication,which may be somewhat handy
in handling escape characters:
I tend to do something like this,trying to rember characters which need to be escaped.
Code: Select all
awk -F[\<\>]
Code: Select all
awk -F"[<,>]"
without the need of considering escaping.
However an escape is needed in this:
Code: Select all
awk -F"[<,>,\"]"
@seaside:Yeah - bashstringsops are speady .and very often ought to be used - instead of the usual filetools.in strings-handling.
Edit: Ok - it took half a day for me to correct my sloppy path to PuppyPin
Added:
Being at it,NO grep but read and bashops may very well be a speedier construct:
Code: Select all
#cnt=1
while read -r line: do
front=${line%'</backdrop'*}
[ ${#line} -ne ${#front} ] && found=1 && break
#cnt=$(($cnt+1)) && [ $cnt -eq 2 ] && break
done</root/Choices/ROX-Filer/PuppyPin
[ $found -eq 1 ] && echo "${front##*'>'}"
More no grep no sed-Being at it,NO grep but read and bashops may very well be a speedier construct:
Code: Select all
while read line; do
[ "${line/<backdrop/}" == "${line}" ] && continue
remove_end=${line/<\/backdrop>/} filename=${remove_end##*>}
done </root/Choices/ROX-Filer/PuppyPin
user 0m0.003s
sys 0m0.000s
Cheers,
s
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
I am not on Puppy right now, but this may work (not 100% on the syntax)seaside wrote:... bashops may very well be a speedier construct:
Code: Select all
BG=`cat /path/to/PuppyPin` #because $(< /path/to/file) is a bashism
BG=${BG#*<backdrop*>} #remove everything up to the bg file
BG=${BG%</backdrop*} #remove everything after the bg file
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].
technosarus;
Averages about the same time as my sed one-liner.
I know it`s not the direct path, but this keeps the time results consistent.
seaside; Couldn`t get yours to echo the /path/image
But yours is twice as fast as technosaurus`s and mine. Odd that looping could be faster, but here you are...
This works for me:
Code: Select all
# time (BG=`cat /root/Choices/ROX-Filer/PuppyPin`;BG=${BG#*<backdrop*>};echo ${BG%</backdrop*} )
/mnt/sda3/docs/pics/EndlessBlue_1680.jpg
real 0m0.006s
user 0m0.003s
sys 0m0.000s
#
I know it`s not the direct path, but this keeps the time results consistent.
seaside; Couldn`t get yours to echo the /path/image
But yours is twice as fast as technosaurus`s and mine. Odd that looping could be faster, but here you are...
This works for me:
Code: Select all
time while read line; do [ "${line/<backdrop/}" == "${line}" ]&& continue; remove_end=${line%</*}; echo ${remove_end#>}; done </root/Choices/ROX-Filer/PuppyPin
grep and busybox grep
Code: Select all
time grep backdrop /root/Choices/ROX-Filer/PuppyPin | grep -o '>.*<'
real 0m0.007s
user 0m0.010s
sys 0m0.003s
Code: Select all
time busybox grep backdrop /root/Choices/ROX-Filer/PuppyPin | busybox grep -o '>.*<'
real 0m0.002s
user 0m0.000s
sys 0m0.000s
seems not to work for me to give time values, just the filename , probably as # time ./script .# time (BG=`cat /root/Choices/ROX-Filer/PuppyPin`;BG=${BG#*<backdrop*>};echo ${BG%</backdrop*} )
Yes .Karl; Explain why it might not work. Because of using # ?