__________________________________________________________________________
I recently learnt usage of "cut" command and using it I made a better script to show drive labels.
Add these functions to /sbin/pup_event_frontend_d:
Code: Select all
blkid_cleaner() {
sleep 5
if [ -f /tmp/blkid.txt ]; then rm /tmp/blkid.txt; fi
}
blkid_name_generator() {
#Gather blkid output and filter out required device
if [ ! -f /tmp/blkid.txt ]; then
blkid -c /dev/null > /tmp/blkid.txt
fi
blkid_cleaner &
LABEL=""
eval $( cat /tmp/blkid.txt | grep "$@:" | cut --delimiter=" " -f 2- | sed -e 's/ /;/g' )
LABEL=${LABEL//;/ }
#Generate drive label
if [ "$LABEL" = "" ]; then ONEDRVLABEL="$@\n \n "; else ONEDRVLABEL="${LABEL}\n($@)\n "; fi
}
Code: Select all
add_pinboard_func() { #needs ONEDRVNAME, DRV_CATEGORY, FSTYPE
#ppPATTERN=' label="'"$ONEDRVNAME"'"'
#v411 rerwin: avoid icon getting duplicated if it is renamed...
ppPATTERN="/root/.pup_event/drive_${ONEDRVNAME}<"
[ "`grep "$ppPATTERN" /root/Choices/ROX-Filer/PuppyPin`" != "" ] && return #precaution.
free_coord
blkid_name_generator $ONEDRVNAME
echo -e "<?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>/root/.pup_event/drive_${ONEDRVNAME}</Path>
<X>${COORD_X}</X>
<Y>${COORD_Y}</Y>
<Label>${ONEDRVLABEL}</Label>
<Args>${DRV_CATEGORY} ${FSTYPE}</Args>
</PinboardAdd>
</env:Body>
</env:Envelope>" | rox -R
if [ "$( cat /root/.drvlist | grep $ONEDRVNAME )" = "" ]; then
echo $ONEDRVNAME >> /root/.drvlist
fi
}
remove_pinboard_func() { #needs DRV_NAME (name of entire drive)
#ppPATTERN=' label="'"$DRV_NAME"'.*" '
#[ "`grep "$ppPATTERN" /root/Choices/ROX-Filer/PuppyPin`" = "" ] && return
#ALLNAMES="`grep -o "$ppPATTERN" /root/Choices/ROX-Filer/PuppyPin | cut -f 2 -d '"' | tr '\n' ' '`" #'geany
#for ONEDRVNAME in $ALLNAMES
#do
#echo "<?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">
#<PinboardRemove>
#<Path>/root/.pup_event/drive_${ONEDRVNAME}</Path>
#</PinboardRemove>
#</env:Body>
#</env:Envelope>" | rox -R
#done
#Rewritten to cope with blkid_name_generator
cat /root/.drvlist | grep "$DRV_NAME" |
while read ONEDRVNAME
do
echo "<?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">
<PinboardRemove>
<Path>/root/.pup_event/drive_${ONEDRVNAME}</Path>
</PinboardRemove>
</env:Body>
</env:Envelope>" | rox -R
sed -i -e "s/${ONEDRVNAME}//g" /root/.drvlist
done
}
This one is a bit faster ( and I also think that the option "-c /dev/null" corrects the problem of incorrect output when another somewhat similarly partitioned hard disk is connected ).
One additional newline at end of each label ensures that the original margin is restored.
_____________________________________________________________________________
I don't think GTK file dialog runs 'mount | grep "/media" '. I concluded this by the following experiment on Puppy 412.jemimah wrote: Plus I think it actually runs something like "mount |grep "/media"
I extracted the pup_412.sfs file into a directory. Then I renamed /mnt to /media, created symlink /mnt pointing to /media and recombined it into an sfs.
When I got puppy to boot using the sfs file thus formed, I got very unexpected results. I mounted a few drives and then opened GTK file dialog, but no drives were listed there (except root and File System). When I ran 'mount | grep "/media" ' in terminal I got:
Code: Select all
# mount | grep "/media"
/dev/sda5 on /media/sda5 type fuseblk (rw,user_id=0,group_id=0,blksize=4096)
/dev/sda6 on /media/sda6 type fuseblk (rw,user_id=0,group_id=0,blksize=4096)
#
abushcrafter wrote: I find I need more padding between the icons because I have longer labels than you two do.
I searched a lot but couldn't find any option for changing text alignment in ROX-FilerSit Heel Speak wrote: When the drive icons are arranged vertically, as in this screencap, the justification of the labels (both volume label and partition drive+number) should not be "center" but rather should match the orientation of the icons, e.g. "right", "left".
...
If it were possible to set margins in icewm, like you can in openbox, it is hard to imagine how it could be better.
I think that icons could be better placed in a panel instead of on pinboard as follows-
This will have several advantages:
1. Users will have choice of aligning icons against any side of the screen.(However at the bottom the panel will be partially covered by the taskbar, rendering it useless)
2. ROX-Filer will automatically manage panel width and icon spacing to accommodate longer labels.
3. Panels can be configured not to allow maximized windows to cover them, so window managers like openbox is not needed for that purpose.
_____________________________________________________________________________