Demo: icons appear automatically when sfs file is mounted

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
User avatar
pakt
Posts: 1157
Joined: Sat 04 Jun 2005, 16:54
Location: Sweden

Demo: icons appear automatically when sfs file is mounted

#1 Post 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
Attachments
desktop.jpg
(43 KiB) Downloaded 930 times
Methinks Raspberry Pi were ideal for runnin' Puppy Linux

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#2 Post 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

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

#3 Post 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
Bring on the locusts ...

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#4 Post 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.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#5 Post 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.

User avatar
e_mattis
Posts: 114
Joined: Fri 21 Dec 2012, 02:24
Location: Williamston, SC
Contact:

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

User avatar
e_mattis
Posts: 114
Joined: Fri 21 Dec 2012, 02:24
Location: Williamston, SC
Contact:

#7 Post by e_mattis »

Post sent twice - Sorry!

User avatar
666philb
Posts: 3615
Joined: Sun 07 Feb 2010, 12:27
Location: wales ... by the sea

#8 Post by 666philb »

hi e_mattis

what do you need this for?
Bionicpup64 built with bionic beaver packages http://murga-linux.com/puppy/viewtopic.php?t=114311
Xenialpup64, built with xenial xerus packages http://murga-linux.com/puppy/viewtopic.php?t=107331

User avatar
e_mattis
Posts: 114
Joined: Fri 21 Dec 2012, 02:24
Location: Williamston, SC
Contact:

#9 Post 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

User avatar
666philb
Posts: 3615
Joined: Sun 07 Feb 2010, 12:27
Location: wales ... by the sea

#10 Post 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
Attachments
test.pet
an example to try
(658 Bytes) Downloaded 288 times
Bionicpup64 built with bionic beaver packages http://murga-linux.com/puppy/viewtopic.php?t=114311
Xenialpup64, built with xenial xerus packages http://murga-linux.com/puppy/viewtopic.php?t=107331

User avatar
e_mattis
Posts: 114
Joined: Fri 21 Dec 2012, 02:24
Location: Williamston, SC
Contact:

#11 Post 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?!?

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

Add a single line in PuppyPin

#12 Post 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.

User avatar
e_mattis
Posts: 114
Joined: Fri 21 Dec 2012, 02:24
Location: Williamston, SC
Contact:

#13 Post 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

Post Reply