You are not logged in.

#1 2010-05-25 19:36:14

comrad
Member
Registered: 2010-01-24
Posts: 6

Volume manage - halevt + traydevice + xdotool

Already for a long time I wanted something, I'll try to describe here now.
What I would like to have as a volume manager is something, that allows to open automatically (on a USB insertion) the console window, then put a string there with command to mount the device basing on the information taking from hal. At the same time something in the tray would be also nice.

So I did the following trick:

I installed halevt, traydevice and xdotool.
In the xml config for halevt I have:

 <halevt:Insertion exec="urxvtcc & tmount.sh $hal.block.device$ $hal.volume.label$ & traydevice $hal.udi$"/>
 <halevt:OnInit exec="urxvtcc & tmount.sh $hal.block.device$ $hal.volume.label$ & traydevice $hal.udi$"/>

The tmount.sh looks as follows:

#!/bin/sh
sleep 1
xdotool type "pmount $1 $2 ; cd /media/$2"

In default.xml I use pmount-hal to mount and pumount to unmount device
------------

So... It works. When I insert the usb stick the console opens and something like:

pmount /dev/sdb1  ARCHISO_COHYAE4A; cd /media/ARCHISO_COHYAE4A

appears.

But there are too many problems in this solution.
1) I don't know how to check if the label is not blank string and use the name of the device (sdX) instead.
2) If I have a whole disk formatted(sdb for example instead of sdb1 etc.) nothing works.
3) Showing the command takes some time and, if I focus another window in the mean time, no message (of course) appears in the needed console.

----------------------------
Tell me if you know, how to achieve what I want in a better way. Just wanted to open a discussion smile

P.S.
I didn't know where to put this message...
If I placed this in a wrong place, just move it into another place

Last edited by comrad (2010-05-25 19:38:18)

Offline

Board footer

Powered by FluxBB