Page 1 of 1

Demo: icons appear automatically when sfs file is mounted

Posted: Mon 26 Mar 2007, 18:08
by pakt
Here is a simple idea for automatically adding desktop icons when mounting an app_xxx.sfs file. This is just a rough example of how it would work.

First I created a minimal test_202.sfs containing:

- OpenOffice icons in /usr/local/lib/X11/pixmaps/
- 'globicons-OOo' and 'PuppyPin-OOo' in /root/Choices/ROX-Filer/ containing the modified desktop files.

Then I modified rc.local0 with one line to run a new script I called rc.desktop which I added to /etc/rc.d/

rc.desktop contains:

Code: Select all

#!/bin/sh

#add icons from application sfs file to Puppy desktop by using the PuppyPin &
#globicons files from the sfs file.
#PuppyPin-OOo & globicons-OOo are located in test_202.sfs
#(executed from rc.local0)

#create master files so original desktop icons can be restored
if [ ! -f /root/Choices/ROX-Filer/PuppyPin0 ];then
  cp -f /root/Choices/ROX-Filer/PuppyPin /root/Choices/ROX-Filer/PuppyPin0
fi  
if [ ! -f /root/Choices/ROX-Filer/globicons0 ];then
  cp -f /root/Choices/ROX-Filer/globicons /root/Choices/ROX-Filer/globicons0
fi  

if [ -d /usr/local/OOo-dir ];then #add icons from mounted sfs application
  cp -f /root/Choices/ROX-Filer/PuppyPin-OOo /root/Choices/ROX-Filer/PuppyPin
  cp -f /root/Choices/ROX-Filer/globicons-OOo /root/Choices/ROX-Filer/globicons
else #restore original desktop icons
  cp -f /root/Choices/ROX-Filer/PuppyPin0 /root/Choices/ROX-Filer/PuppyPin
  cp -f /root/Choices/ROX-Filer/globicons0 /root/Choices/ROX-Filer/globicons
fi
Now when I add 'test_202.sfs' to the same location as pup_202.3fs and reboot, the icons appear automatically on the desktop.

Paul

Posted: Tue 27 Mar 2007, 01:18
by BarryK
Okay, I've added desktop icon updating to Puppy, and made it generic
to work for any SFS files. See News Blog:
http://www.puppyos.net/blog/comments.ph ... 326-080421

Posted: Tue 27 Mar 2007, 01:43
by Nathan F
Cool, I'm just wondering about one or two small details now. One is basically whether or not there is any provision for making sure the icons don't overlap each other. Otherwise I can see things getting very messy. The other issue might be if a user decides they want to remove them. I'm hoping this doesn't just put them back every time the squashfile is mounted?

Nathan

Posted: Tue 27 Mar 2007, 02:53
by Pizzasgood
Doesn't that just copy a pre-set file over the current one? So any changes to the original would be lost until the sfs is removed? And it wouldn't work with multiple sfs files at once either.

Maybe there should be something like XDG, but for the desktop. Where it just loads any files in a certain place. Positioning would be the tricky part. It could be that the positioning data is optional. If you don't add any, it will place it wherever it's convenient.

Also, that would slightly complicate things if the user edits a "sfs" icon, creating a copy in the save-file. Unless there was a "temporary" tag inside it. Then it could do a if [ -e <whatever> ]; then <show icon>; fi where <whatever> is the app it's supposed to run.

Actually, that could apply to all of them, like how IceWM only shows entries for apps that are installed.

Posted: Tue 27 Mar 2007, 15:19
by BarryK
The code I posted merges the 'PuppyPin' and 'globicons' files. Duplicate lines in the merged PuppyPin are removed. It does not fix overlapping icons. For a 'openoffice.sfs', just create a PuppyPin and globicons with the OO icons only and make sure they are located on the desktop away from the others.

My code only regenerates PuppyPin and globicons files if the unionfs layers change. So, a user can customise the desktop, but if they change the layers, their customisation gets wiped. I currently don't know an elegant fix for this.

Posted: Tue 29 Apr 2014, 20:29
by e_mattis
Barry,

it's old hack, but I find i need this info again. the blog link above doesn't work. it that blog/page still around anywhere?

Posted: Tue 29 Apr 2014, 20:31
by e_mattis
Post sent twice - Sorry!

Posted: Wed 30 Apr 2014, 14:31
by 666philb
hi e_mattis

what do you need this for?

Posted: Wed 30 Apr 2014, 23:21
by e_mattis
hey 666philb,

i'm putting together a "suite" of programs and I need the icon to appear when the .sfs is installed so you don't have to go searching files to run it the first time. Any ideas? Thanks!

E

Posted: Fri 02 May 2014, 11:59
by 666philb
hi e_mattis,

the problem is that .sfs files don't run pinstall.sh scripts ..... if you where using a pet instead of an sfs it would be more straight forward.

one idea though is to use a .pet to install the sfs .... so you'ld install the pet and it would download the sfs .... load it ... and add a desktop icon/s .


a rough example of the pinstall.sh ...

Code: Select all

#!/bin/sh
cd /root
rxvt -e wget http://dl.dropbox.com/u/148498739/google_earth-7_sfs4.sfs
`xmessage -name 'sfsload' -center -bg white -fg blue "please chose the move option from the sfs_loader"`
sfs_load /root/google_earth-7_sfs4.sfs

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">
 <PinboardAdd>
   <Path>/usr/share/applications/google-earth.desktop</Path>
    <X>32</X>
    <Y>512</Y>
   <Label>googleearth</Label>
   </PinboardAdd>
</env:Body>
</env:Envelope>
EOF

Posted: Sat 03 May 2014, 01:24
by e_mattis
hey 666philb,

tried the test.pet on a live-cd run of precise 5.7.1 but had no luck - got the desktop alert icon and name, copied into PuppyPin, but other than that, nope, no google earth. no modification to /root/.config/rox.sourceforge.net/ROX-Filer/globicons or /usr/bin. Maybe due to live cd - will try on frugal later.

This may be the route i'm looking for though, if I can figure out how to correctly assemble the pet and write the pinstall.sh script - working on that now.

Thanks !

E

UPDATE 050314:
@ 666philb,
i've still had no luck getting your script to run on my system (precise 5.7.1).

@ all
I've been searching and reading, and reading, and read...etc...to try and find out how to write a pinstall script that would add an entry to PuppyPin. I've found a lot of information, but none seems to pan out - simple as

Code: Select all

#!/bin/bash
echo '<icon x="32" y="500" label="newLine">/directory/directory</icon>'
to some more sophisticated and involved than I really want to get. I di find something close done by rhadon back in 2013 for the swapicons project here:http://murga-linux.com/puppy/viewtopic.php?t=83829 but just haven't been able to wrap my head around how to add a single line in.

help?!?

Add a single line in PuppyPin

Posted: Sun 04 May 2014, 07:36
by L18L
e_mattis wrote:@ all
I've been searching and reading, and reading, and read...etc...to try and find out how to write a pinstall script that would add an entry to PuppyPin. I've found a lot of information, but none seems to pan out - simple as

Code: Select all

#!/bin/bash
echo '<icon x="32" y="500" label="newLine">/directory/directory</icon>'
to some more sophisticated and involved than I really want to get. I di find something close done by rhadon back in 2013 for the swapicons project here:http://murga-linux.com/puppy/viewtopic.php?t=83829 but just haven't been able to wrap my head around how to add a single line in.

help?!?
Seen in function desktop_icon of script set_LANGUAGE_and_lauch_app in Multiligual simultan :

Code: Select all

  sed -i "s#</backdrop>#</backdrop>\n  <icon x="$SCREENx" y="$SCREENy" label="${LABEL}">/usr/local/apps/setLanguage</icon>#" ${PUPPYPIN}
Hope that helps.

Posted: Sun 04 May 2014, 09:08
by e_mattis
hey L18l!
:D now you tell me :lol:

yea, it does help. I found this snippet on another post (don't remember which one) and was in mid-figure when I came back and saw your post.

Code: Select all

#!/bin/sh 
# LazY Puppy Run-Scripts Icon Setter 
# set icon to a run-script # --> thanks to stu90 
#------------------------------------------------------------------------------ 
FILE=$1 
ICON=$2 

head -n -1 /root/.config/rox.sourceforge.net/ROX-Filer/globicons > /tmp/globicons 

cat >> /tmp/globicons << EOF 
  <rule match="$FILE"> 
    <icon>$ICON</icon> 
  </rule> 
</special-files> 
EOF 

rm -f /root/.config/rox.sourceforge.net/ROX-Filer/globicons 
cp -f /tmp/globicons /root/.config/rox.sourceforge.net/ROX-Filer/globicons 

# End 
It helped me understand things better and how sed works. thanks to you and 666philb for the responses and assistance. I think I actually got a working .pet this time! But it's late here now, so I will test it tomorrow.

Thanks again! :)

E