Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 24 Apr 2014, 03:34
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Lighweight pup_event_frontend_d Replacement
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 3 of 3 [40 Posts]   Goto page: Previous 1, 2, 3
Author Message
Iguleder


Joined: 11 Aug 2009
Posts: 1776
Location: Israel, somewhere in the beautiful desert

PostPosted: Sat 01 Jun 2013, 11:10    Post subject:  

Good news!

I wrote a handler which creates desktop icons and lets ROX-Filer automatically position them, so they appear right after the existing ones. See the screeny for an example. This handler uses Puppy-style icons which match the partition type and change once the partition is mounted. The sources are attached Smile

It's possible to use Puppy's icon positioning algorithm but it's quite dirty and I like it more when icons are automatically arranged.

First impressions? Very Happy
part-hotplug-handler.tar.bz2
Description 
bz2

 Download 
Filename  part-hotplug-handler.tar.bz2 
Filesize  18.16 KB 
Downloaded  112 Time(s) 
screeny.png
Description 
png

 Download 
Filename  screeny.png 
Filesize  47.37 KB 
Downloaded  160 Time(s) 

_________________
My homepage
Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
ICQ Number 
simargl

Joined: 11 Feb 2013
Posts: 572

PostPosted: Sat 01 Jun 2013, 17:49    Post subject:  

.
Last edited by simargl on Sun 01 Sep 2013, 11:13; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
charlie6

Joined: 30 Jun 2008
Posts: 940
Location: South of Belgium

PostPosted: Sat 01 Jun 2013, 23:58    Post subject:  

Hi Iguleder,
here impressions on wheezy-3.5.2.5
- have extracted the part-hotplug-handler.tar.bz2
- have compiled part-hotplug-monitor.c > got part-hotplug-monitor (just ran make)
- have copied + rendered them executable
part-hotplug-monitor
part-hotplug-handler
part-icon
to /usr/bin
- have made a symlink for part-hotplug-monitor pointing to /sbin where /sbin/pup_event_frontend_d is present
- have disabled the existing pup_event_frontend_d and renamed whatever anme;
- have renamed pup_event_frontend_d the symling part-hotplug-monitor

restarted X ... wait a rather long long time till X actually restarted ... and got X desktop displayed without any drive icon.

running ./sbin/part-hotplug-monitor in a console: part-hotplug-monitor seems hanging up as there is no comment and nothing happens...

have i missed something ...?
Charlie
Back to top
View user's profile Send private message 
Iguleder


Joined: 11 Aug 2009
Posts: 1776
Location: Israel, somewhere in the beautiful desert

PostPosted: Sun 02 Jun 2013, 12:45    Post subject:  

Yep, two things:
- It doesn't output anything.
- It still doesn't draw icons for existing partitions, only for newly added ones. Wink

_________________
My homepage
Back to top
View user's profile Send private message Visit poster's website MSN Messenger 
ICQ Number 
jamesbond

Joined: 26 Feb 2007
Posts: 1879
Location: The Blue Marble

PostPosted: Sun 02 Jun 2013, 13:25    Post subject:  

@charlie6
To display existing partitions you need to re-trigger udev. See my comment for Karl, in the previous page.

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13
Back to top
View user's profile Send private message 
charlie6

Joined: 30 Jun 2008
Posts: 940
Location: South of Belgium

PostPosted: Sun 02 Jun 2013, 17:57    Post subject:  

@Iguleder & Jamesbond
Smile
thanks for your help!
it works as expected ...how fast .. Cool ... and believe i will keep it for a while, even if some icons have falled outside the desktops bottom edge ... Shocked
see attached screenshot (wheezy-3.5.2.5 1280x1024 resolution)
installation:
all files placed in /usr/bin (after compilation !!)
+
symlinked /usr/bin/part-hotplug-monitor to /sbin/part-hotplug-monitor
+
disactivated /sbin/pup_event_frontend_d
+
renamed it /sbin/pup_event_frontend_d.txt
+
renamed the symlink /sbin/part-hotplug-monitor to /sbin/pup_event_frontend_d

Pmount helps for opening disk that are not displayed (red circled); sdb1 to sdc10 have been plugged after above installation ended.

doing afterwards in console (thanks 2 Jamesbond):
Code:
 udevadm trigger --action=add

results in sda1 to sda6 icons to be displayed;
have manualy reorderd the icons as shown;
Menu/restart X process is much slower ---> be patient ! Rolling Eyes
cheers, charlie
part-mount.jpg
 Description   
 Filesize   26.25 KB
 Viewed   193 Time(s)

part-mount.jpg

part-mount_2.jpg
 Description   
 Filesize   29.77 KB
 Viewed   184 Time(s)

part-mount_2.jpg

Back to top
View user's profile Send private message 
charlie6

Joined: 30 Jun 2008
Posts: 940
Location: South of Belgium

PostPosted: Sun 02 Jun 2013, 18:21    Post subject:  

re-Hi...
1. unplugging and plugging again results in ... a kind of icons "overpopulating" of the desktop...
2. clicking on the X in the icon does not unmount it. Pmount is the only way to unmount?
3. how to erase them when unplugged ...?
restart X does not help....

last edited:
...3.(follow and solved) unplugging the usb flash plugs ---> the corresponding icons switch off ...only the first displayed set remains. OK i understand: this first set displayed, in the above post procedure, upon plugging a flash plug + an usb hdd, before doing « #udevadm trigger --action=add » in console.
So do « #udevadm trigger --action=add » BEFORE plugging.
(for info: i just had to right click on the extra icons and then click «remove item» to erase .

and
4. cd-or-dvd-inserted's icons are not (yet ...?) displayed. I had a dvd inserted along the whole above procedure and not any «sr0» nor «sr1» icon. Yes...the present part-icon-handler manages only USB plugged stuffs, no optical devices.
At this state of art, use of Pmount to manage them.

cheers
plug-unplug.jpg
 Description   
 Filesize   22.63 KB
 Viewed   182 Time(s)

plug-unplug.jpg


Last edited by charlie6 on Sun 02 Jun 2013, 23:34; edited 1 time in total
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 878

PostPosted: Sun 02 Jun 2013, 23:31    Post subject:  

Iguleder,

Very nice work.

I decided to test this by a normal startup, killing pup_event_frontend_d, and then starting part-hotplug-monitor and plugging in a thumb drive.

Since the icon came up on the left just below "connect", I made some changes in the part-icon script to locate the icon in line with the other drives.

As there was no direct way to unmount the drive, I also made some changes to toggle unmounting by left clicking.

First click, mounts and starts the file manager, second click unmounts the drive....etc..

Other possibilities exist to specify the icon x,y position somewhere else as well.

All the programs are in /usr/bin with no symlinks

Thanks again for this simple direct approach.
Regards,
s
Code:
#!/bin/sh
# part-icon: a utility script for adding and removing ROX-Filer pinboard icons
#            for partitions
# modded to toggle mount and icon placement

# the ROX-Filer command line used for RPC
ROX_RPC_COMMAND_LINE="rox -R"

# _get_partition_icon()
# purpose: determines which icon should be used to represent a partition
# input  : the mount point and device node path of a partition
# output : an icon path
_get_partition_icon() {
   # choose the partition icon, according to the device node name
   case "$2" in
      *floppy*)
         type="floppy"
         ;;
      *mmc*)
         type="card"
         ;;
      *cdrom*|*sr*)
         type="optical"
         ;;
      *sd*)
         type="usbdrv"
         ;;
      *)
         type="drive"
         ;;
   esac

   # if the partition is mounted, add a suffix to the icon name
   mountpoint -q "$1"
   if [ 0 -eq $? ]
   then
      suffix="_mntd"
   else
      suffix=""
   fi

   echo -n "/usr/local/lib/X11/pixmaps/${type}${suffix}48.png"
}

# _update_partition_icon()
# purpose: changes the icon of a partition to the most suitable one
# input : a partition name
# output: -
_update_partition_icon() {
      echo -n "<?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\">
   <SetIcon>
      <Path>$HOME/.part-hotplug-handler/$1</Path>
      <Icon>$(_get_partition_icon /mnt/$1 $1)</Icon>
   </SetIcon>
</env:Body>
</env:Envelope>" | $ROX_RPC_COMMAND_LINE
}

case "$1" in
   add)
      # check the command-line usage
      if [ 3 -ne $# ]
      then
         echo "Usage: part-icon remove PARTITION DEVICE_NODE"
         exit 1
      fi

      # create a directory for the partition mounting scripts
      [ ! -d $HOME/.part-hotplug-handler ] && \
                                             mkdir $HOME/.part-hotplug-handler

      # create the partition mounting script
echo -n "#!/bin/sh
if ! [ -d /mnt/$2 ] #  check whether mount dir exists

then
   # create a mount point
   mkdir /mnt/$2
   [ 0 -ne \$? ] && exit 1
   # mount the partition
   mount \"$3\" /mnt/$2
   [ 0 -ne \$? ] && exit 1
    xdg-open /mnt/$2
    # mark icon mounted
    part-icon update $2
   
else # check if mounted

  if mountpoint -q /mnt/$2
  then
 
   umount /mnt/$2
   [ 0 -ne \$? ] && exit 1
   # change icon to unmounted
   part-icon update $2
  else
   mount \"$3\" /mnt/$2
   [ 0 -ne \$? ] && exit 1
    xdg-open /mnt/$2
    # mark icon mounted
    part-icon update $2
  fi

fi

" > $HOME/.part-hotplug-handler/$2
      chmod 755 $HOME/.part-hotplug-handler/$2

      # set the icon used
      _update_partition_icon $2
      # align to bottom icons
      line=`grep  'label=\"[[:alpha:]]\{3\}[0-9]' /root/Choices/ROX-Filer/PuppyPin | head -n 1`
      x=${line#*\"} x=${x%%\"*}
      x=$((x+64)) y=704
            
      # add a pinboard icon
      echo -n "<?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>$HOME/.part-hotplug-handler/$2</Path>
         <Label>$2</Label>
         <X>$x</X> <Y>$y</Y>
          <Args></Args>
      </PinboardAdd>
   </env:Body>
</env:Envelope>" | $ROX_RPC_COMMAND_LINE
      ;;

   remove)
      # check the command-line usage
      if [ 2 -ne $# ]
      then
         echo "Usage: part-icon remove PARTITION"
         exit 1
      fi

      # unmount the partition and delete the mount point
      if [ -d /mnt/$2 ]
      then
         mountpoint -q /mnt/$2
         if [ 0 -eq $? ]
         then
            umount /mnt/$2
            [ 0 -eq $? ] && rmdir /mnt/$2
         fi
      fi

      # remove the pinboard icon
      echo -n "<?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>$HOME/.part-hotplug-handler/$2</Path>
         <Args></Args>
      </PinboardRemove>
   </env:Body>
</env:Envelope>" | $ROX_RPC_COMMAND_LINE

      # remove the partition mounting script
      rm -f $HOME/.part-hotplug-handler/$2
      ;;

   update)
      # check the command-line usage
      if [ 2 -ne $# ]
      then
         echo "Usage: part-icon update PARTITION"
         exit 1
      fi

      # update the partition icon
      _update_partition_icon "$2"
      ;;
esac
Back to top
View user's profile Send private message 
charlie6

Joined: 30 Jun 2008
Posts: 940
Location: South of Belgium

PostPosted: Mon 03 Jun 2013, 01:15    Post subject:  

Hi seaside,
thanks a lot !
i replaced the existing part-icon by yours
and
deleted the symlink /sbin/pup_event_frontend_d to /usr/bin/part-hotplug-monitor;
afterwards creted a script to exec /usr/bin/part-hotplug-monitor and placed it in /root/Startup and rebooted.

I then plugged some thumb drives and got them each twice displayed ... Shocked

i even did « #udevadm trigger --action=add » or « #udevadm trigger --action=change » before plug-in without change.

questions:
Quote:
and then starting part-hotplug-monitor

which way do you start part-hotplug-monitor?

Quote:
First click, mounts and starts the file manager, second click unmounts the drive....etc..

whatever right or left click, here it mounts and opens a rox-window at first click, but no unmount at second click; got a second rox-window opened instead.

Maybe had better to start all over from the beginning ..?

cheers

last edited:
icon display versus Pmount status at start: see screenshot below:
«sdc1=mounted» icon whereas Pmount reprots «not mounted»
start.jpg
 Description   
 Filesize   22.76 KB
 Viewed   161 Time(s)

start.jpg

Back to top
View user's profile Send private message 
charlie6

Joined: 30 Jun 2008
Posts: 940
Location: South of Belgium

PostPosted: Mon 03 Jun 2013, 03:06    Post subject:  

re-re-Hi Very Happy

using forum member seaside's part-icon
+
no symlink to part-hot-plug-monitor (pup_event-frontend_d = «killed»)
+
part-hot-plug-monitor started from /root/Startup:

follow...
i manualy erased (right-click on icon + remove object) the extra icons set;
then rebooted;
the icons are now displayed one each.

(time to shutdown is here long..long..long..be patient)

Cheers
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 3 of 3 [40 Posts]   Goto page: Previous 1, 2, 3
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0954s ][ Queries: 12 (0.0143s) ][ GZIP on ]