On Sun, Apr 30, 2006 at 11:23:18 -0300, Gurvan Huiban wrote: > On Sunday 30 April 2006 11:01, Florian Kulzer wrote: > > > Actually, it works great. The only thing that bothers me is that I don't > > > know how to define my own actions? I searched, but I could not find how > > > to do it. > > > > If I remember correctly, you can choose from a set of standard actions > > when you insert a new media type for the first time. You can change this > > later and also select other programs/commands to handle a given media > > type if you go to "K-Menu > Control Center > Storage Media > > > Notifications > Add / Toggle as Auto Action". (You also need to activate > > the three options on the "Advanced" tab for this to work.) > > That's correct. I missed it. > > However, I can't make it work the way I would like to. For instance, let's > suppose that I want to mount automatically any removable device, without > opening Konqueror window. > > I created and added to the unmounted removable device the "Automount" action, > executing the following command: > pmount %u > But it does nothing! (actually, I don't know exactly what is this %u. My > guess > is that it is a string corresponding to the /dev/device_detected). > > And when I click on the help, it says something like "write me", which is > not > so helpful :o)
Yes, I could not find any good help on this either. I then used kdialog --msgbox %u as the command. You get a message box which tells you that %u is actually the URL to the device as konqueror needs it, i.e. something like "system:/media/sda1". Not surprisingly, pmount does not like this at all. I tried to use sed or cut to extract the relevant part of this string and pipe it to pmount, but this does not work if I put it into the command box directly, probably because %u does not fit into the normal shell parameter expansion scheme. In the end I had to do it using a short bash script: --------------------8<-------------------- #! /bin/bash # pmount-wrapper script to automount removable devices pmount /dev${1#system:/media} -------------------->8-------------------- If you save this as "pmount-wrapper.sh" (without the two scissor lines) and make it executable for your user, you can set the command to pmount-wrapper.sh %u and the automounting should work. Of course, the script has to be somewhere in your $PATH so that it can be found, or you have to specify the full path explicitly in the command box. -- Regards, Florian