rox icons + ivman continued

I have made some significant improvements to the previous rox.panelput script I had posted . It can now handle most of the previous “problems”.

a) If the device has a Label then, the icon created has the Label name. If it doen’t it has the Device Name.
If you insert a DVD with label “TEST”…the icon will have the name TEST, if you insert your usb key or your digital camera the icon will have the name of the device.

b) It handles automatic positioning of the icons.
If you insert a DVD (device 1 – icon 1) and then your usb key (device 2 – icon 2), your usb key icon will be placed below the DVD icon. If you then insert your digital camera (device 3 – icon 3) it will be placed below the usbkey. If you then remove your usb key (device 2 – icon 2) there will be left an empty spot at “place 2” and upon the insertion of a new device, a cdrom for example that device will take “place 2” (device 4 – icon 2).

c) There is a Restore feature.
If you place rox.panelput Restore inside your window manager startup file, for example fluxbox’s .fluxbox/startup, it will clean up any unused icons left on the desktop that were not ejected-removed during the previous shutdown of your window manager. Restore will NOT remove icons from your desktop that were not created by rox.panelput script. This feature is really critical because with the older script icons were left over during restarts, hogged up the desktop and had to be manually removed. Now they are removed “automagically”.

d)Locks and checks
Many locks and checks were implemented during each stage of addition or removal of a device. They might slow down the script a bit, but add a great deal of security.

The UPDATED version of rox.panelput lies here: rox.panelput v0.34

In order to use it read the previous post: create-icons-on-rox-desktop-of-automounted-media-by-ivman
(and of course gunzip the file and place it in your binaries folder)

The only change that needs to be done is that IF you want to use the restore feature (which I strongly urge you to do so) you have to put the command:
rox.panelput Restore

somewhere before your window manager starts. Here’s my .fluxbox/startup :

rm /tmp/rox-ivman-lock.tmp
/PATH/TO/rox.panelput Restore
killall -9 ivman ; ivman &
echo > /home/CHANGEME/.ivman/mounted/devices
rox -p pinboard
exec /usr/bin/fluxbox -log ~/.fluxbox/log

If you change the paths or files inside rox.panelput then it’s almost sure that you have to change these paths too.

Please report any problems and give me any possible feed back on this.

17 Responses to “rox icons + ivman continued”

  1. DARKGuy
    December 18th, 2006 | 08:42
    Using Epiphany Epiphany 2.16 on Ubuntu Linux Ubuntu Linux

    Hey, I followed both of your HowTos… nice ones! it works nice for automounting the device, BUT it doesn’t puts the icon in Rox! I’m using Ubuntu installed using the alternate CD (so it’s basically a core CLI linux with X, Fluxbox and apps installed, no ubuntu stuff except for the repositories and the gnome libraries and stuff) and when I run rox.panelput (even with Restore, or with /media/MSCN) I get:

    :/usr/bin$ rox.panelput Restore
    NUMLINES = 1
    [: 138: ==: unexpected operator
    [: 138: ==: unexpected operator
    [: 138: ==: unexpected operator
    [: 156: ==: unexpected operator
    [: 156: ==: unexpected operator
    [: 164: ==: unexpected operator

    What can I do? help would be greatly appreciated!

  2. site admin
    December 18th, 2006 | 12:54
    Using Mozilla Firefox Mozilla Firefox 1.5.0.8 on Linux Linux

    Updated rox.panelput: rox.panelput ver 0.32

    just change your homedir and replace the old one. The format of the mounted devices has changed a bit…so you might need to del your old one first.
    The same version of this script + ROX works quite OK (I think) under the iloog liveCD. You might want to give that a try to see if the setup looks like yours…

    Please report any success or failures with this one….

  3. Preben
    April 1st, 2007 | 03:23
    Using Debian IceWeasel Debian IceWeasel 2.0.0.3 on Debian GNU/Linux Debian GNU/Linux

    Hi

    I have followed the recipe, but I have one problem that I cannot get to work and that is that I don’t get ivman to call the rox.panelput Add

    I mean if I punmount a usbstick then rox.panelput Remove is always run, but as the usb stick is put in the usb the rox.panelput Add is not called. I checked this by running another program at the beginning of rox.panelput and it is only run when punmount

    Any ideas?

  4. April 1st, 2007 | 03:57
    Using Mozilla Firefox Mozilla Firefox 2.0.0.2 on Linux Linux

    You can see what the ivman does by starting ivman -d –nofork. It should give you enough information about what is really going on when you plug in a usb device. This is the output I get when I plug in my usb stick. You can clearly see rox.panelput running at some point.

    IvmConfig/IvmConfigCommon.c:168 (ivm_device_is_mountable) UDI /org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9 is device /dev/corsair
    IvmConfig/IvmConfigCommon.c:323 (ivm_device_is_mountable) Device /dev/corsair appears to be mountable
    manager.c:1014 (ivm_media_changed) Attempting to mount device /dev/corsair
    manager.c:786 (ivm_run_command) Running: pmount '/dev/corsair'
    manager.c:1064 (ivm_media_changed) Device /dev/corsair is mounted at /media/corsair
    IvmConfig/IvmConfigCommon.c:168 (ivm_device_is_mountable) UDI /org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9 is device /dev/corsair
    IvmConfig/IvmConfigCommon.c:323 (ivm_device_is_mountable) Device /dev/corsair appears to be mountable
    manager.c:844 (ivm_is_dvd) Checking for video DVD in device '/dev/corsair' mounted at '/media/corsair'
    manager.c:863 (ivm_is_dvd) /dev/corsair does not look like a video DVD
    IvmConfig/IvmConfigCommon.c:168 (ivm_device_is_mountable) UDI /org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9 is device /dev/corsair
    IvmConfig/IvmConfigCommon.c:323 (ivm_device_is_mountable) Device /dev/corsair appears to be mountable
    hal_interface.c:164 (hal_device_property_modified) Mounted: /org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9
    hal_interface.c:178 (hal_device_property_modified) Devices table has 1 entries
    hal_interface.c:325 (print_device) "/org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9" "/dev/corsair"
    IvmConfig/IvmConfigCommon.c:168 (ivm_device_is_mountable) UDI /org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9 is device /dev/corsair
    IvmConfig/IvmConfigCommon.c:323 (ivm_device_is_mountable) Device /dev/corsair appears to be mountable
    manager.c:786 (ivm_run_command) Running: /usr/bin/rox.panelput Add "/media/corsair" "CORSAIR"
    hal_interface.c:48 (hal_device_added) New Device: /org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9_0
    IvmConfig/IvmConfigCommon.c:168 (ivm_device_is_mountable) UDI /org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9_0 is device /dev/corsair
    IvmConfig/IvmConfigCommon.c:323 (ivm_device_is_mountable) Device /dev/corsair appears to be mountable
    manager.c:1014 (ivm_media_changed) Attempting to mount device /dev/corsair
    manager.c:786 (ivm_run_command) Running: pmount '/dev/corsair'
    Error: device /dev/corsair is already mounted to /media/corsair
    NUMLINES = 1
    We are adding a device
    DEVICECOUNT = 0
    spot = 1
    THEPSI = 50
    manager.c:1030 (ivm_media_changed) /org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9_0 wasn't mounted, by us or by others...
    IvmConfig/IvmConfigCommon.c:168 (ivm_device_is_mountable) UDI /org/freedesktop/Hal/devices/volume_uuid_D4B4_A5D9_0 is device /dev/corsair
    IvmConfig/IvmConfigCommon.c:323 (ivm_device_is_mountable) Device /dev/corsair appears to be mountable

    Are you sure you have succesfully edited the .ivman/IvmConfigProperties.xml config file ?
    The relevant part should look quite like this:

    <ivm:Option name="checkOnInit" value="false" />
    <ivm:Match name="*" value="true">
    <ivm:Property name="hal.volume.is_mounted">
    <ivm:Action value="true" exec='/usr/bin/rox.panelput Add "$hal.volume.mount_point$" "$hal.volume.label$"' />
    </ivm:Property>
    </ivm:Match>

  5. Staz
    April 2nd, 2007 | 17:43
    Using Mozilla Firefox Mozilla Firefox 2.0.0.3 on Windows Windows XP

    I don’t understand why you are asking us to modify the $HOME variable in the script, or even why you have one, since there is an already existing HOME variable in the environment variables

  6. April 2nd, 2007 | 18:34
    Using Mozilla Firefox Mozilla Firefox 2.0.0.2 on Linux Linux

    The HOME variable in the script is indeed unnecessary if someone uses his real home path for it. I’ll correct it.

    The scripts posted here are neither perfect nor optimized. They do work for me though, so I posted them. If anyone wants to correct/optimize them I’d be glad if he posted his work someplace and notified me by a comment here. That’s what the open source is all about..right ? 🙂

  7. Hector Acevedo
    October 29th, 2007 | 04:37
    Using Opera Opera 9.24 on Linux Linux

    Hi,

    I use Fluxbox+Rox and find the combo great. I’ve been also using ivman for mounting/unmounting my USB devices but to Eject them I have to be root and go to /media. This is a hassle and I feel your above method could provide the solution.

    However, I DO NOT use Rox pinboard feature (I like to have a clean desktop) and only use Rox panel. I kwonder if the above will work in this case or which tweaking will be required for the purpose.

    Any comments/suggestions will be most welcome. Thanks

    Hector

  8. October 30th, 2007 | 02:05
    Using Opera Opera 9.24 on Linux Linux

    If you don’t use rox pinboard I can’t think of any other place to have an “icon” to umount/eject your usb devices. What did you have in mind ? Where would you like to have a place to show the devices and be able to eject them if that place is not the “desktop” ?

  9. November 5th, 2007 | 18:56
    Using Opera Opera 9.24 on Linux Linux

    Hi!

    Thanks for the quick response. I see your point above, but currently my rox panel accepts an icon which shows an attention sign if no usb device is plugged in. This icon changes to the familiar blue folder with a green lighted circle when my pen drive is inserted and mounted. All this happens automatically via ivman. I have added text to be displayed under the icon (USBDiskPro, which is the id of my pen-drive).

    The sole remaining problem, in my case, is the inconvenience of becoming root and navigating to /media to eject the device. If I can solve this, then the whole thing will work as I want. (I’m not concerned with device names, or icon position, etc.).

    Moreover, right-clicking on the panel icon shows the usual rox menu AND includes an Eject option. Choosing this one yields an error message: “Device /dev/sda1 was not mounted by you, eject: unmount of `/media/sda1′ failed, eject failed”.

    There’s also the option ‘Mount point USBDiskPro’ which shows Unmount in a sub-menu. Clicking on this one also shows an error message: “Unmounting
    /media/sda1, umount: /media/sda1 is not in the fstab (and you are not root) Unmount failed.

    Please excuse my questioning, but I am a newbie in Linux and still groping for several items/places to learn and improve my skills. Any ideas?

  10. November 5th, 2007 | 19:39
    Using Mozilla Firefox Mozilla Firefox 2.0.0.8 on Linux Linux

    make sure your user belongs to the “plugdev” group to be able to eject the device properly.
    Here’s my current eject script:

    #!/bin/sh
    rox.panelput Remove "$1";
    echo "1=$1"
    TOSCAN=`echo "$1" | sed -e 's/ /\\\\\\\40/g'`
    TOUMOUNT=`grep "$TOSCAN" /proc/mounts | cut -d" " -f1`
    echo "TOUMOUNT=$TOUMOUNT"
    pumount "$TOUMOUNT"
    eject.old -v -p "$TOUMOUNT"

    You can download iloog liveCD to check how exactly my scripts work. Use it as an example for your pc 🙂

  11. Brunus
    January 31st, 2008 | 20:20
    Using Mozilla Firefox Mozilla Firefox 2.0.0.1 on Windows Windows XP

    Hi.
    Very nice work I think !

    But I have a problem to make it run on Fluxbuntu. I think it’s a prob with ivman only. If I Try to run rox.panelput Add /media/U3 it answers :
    wc: /home/myhome/.ivman/mounted/devices: No such file or directory
    NUMLINES =
    (simplified output there)
    145 unexpected operator
    145 same as above
    145 same
    163 same
    163 same
    171 same

    I tried to reconfigure (dpkg-reconfigure ivman) but still not working.
    What I did wrong ? Do you have an idea please ?

    Thanks a lot for any answer.

    Sincerely.

  12. January 31st, 2008 | 22:53
    Using Opera Opera 9.25 on Linux Linux

    I’ve uploaded a new version (0.33) of the rox.panelput script. You will find the link on the post. I hope it works better now for you.

    I am also in the process of rewriting the script from bash to python so that it becomes a bit more sane…

  13. Brunus
    February 1st, 2008 | 13:15
    Using Mozilla Firefox Mozilla Firefox 2.0.0.1 on Windows Windows XP

    Hi.
    I used the last release of your script and I have a new error.
    I don’t have anymore the problem with .ivman/mounted/devices, but still have a :
    152 unexpected operator
    152 same
    152 same
    170 same
    170 same
    178 same

    When I plug my USB key, I can open the media/mykey folder and browse it but there is nothing un the file .ivman/mounted/devices. It’s empty…I Think the problem is here…right ?

    Best regards.

  14. April 15th, 2008 | 22:46
    Using Opera Opera 9.27 on Linux Linux

    rox.panelput 0.34 posted after a suggestion by a reader.

  15. Xaos
    August 19th, 2008 | 00:13
    Using Mozilla Firefox Mozilla Firefox 3.0.1 on Windows Windows XP

    Those of you that are getting the unexpected errors need to make one change to the rox.panelput script.

    Change the first line from:

    #!/bin/sh

    to

    #!/bin/bash

    This script uses bash-specific features that are NOT compliant with generic ‘sh’. Ubuntu has changed (a while back if I remember correctly) to using dash as it’s default shell. So, this should fix your issues.

  16. Andreas Bergvall
    October 4th, 2008 | 12:41
    Using Internet Explorer Internet Explorer 7.0 on Windows Windows XP

    Hi,

    I’m using fluxbuntu with rox and ivman and found another solution for my USB sticks after playing around.
    First there is a fluxbuntu(?) bug requiring us to do mkdir ~/.ivman if it doesn’t exist. Otherwise it woun’t mount correctly.
    Secondly I needed to change the unmount command from ‘umount’ to ‘pumount’ (in rox options-ActionWindow)
    Third I edited /etc/ivman/IvmConfigActions.xml :

    I haven’t compared fbroxautomount in detail with your rox.panelput, but I assume they do more or less the same things.
    Anyone knows any drawback with this fix? (except for removal at unplugg rather than unmount)

  17. Andreas
    October 4th, 2008 | 12:49
    Using Internet Explorer Internet Explorer 7.0 on Windows Windows XP

    In my above post, the xml code was unfortunately filtered out. Not sure how to do this but I’ll make a new try, removing all chevrons:

    ivm:Match name=”ivm.mountable” value=”true”
    ivm:Option name=”mount” value=”true”
    Add the following line, which will remove the icon when you unplugg the device:
    ivm:Option name=”execun” value=”fbroxautomount Remove $hal.volume.mount_point$”
    ivm:Match

    Note: You need to edit the file as sudo.

Leave a reply