This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How to execute a script when a "media" is mounted with StorageMedia

Tags: None
(comma "," separated)
ouimet
Registered Member
Posts
2
Karma
0
I need to configure KDE to execute a little script (a message displayed to users) when Storage Media mounts a USB memory drive or CD/DVD. I looked everywhere and cant find it! Is there a way to do this?

Thanks,
Daniel
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
What version of KDE? I do not think you can configure it to run a script, however even with KDE 3. Device notifications are currently unavailable in KDE 4.

Either way, you could write a program that listens for the mounting of devices and then creates a popup, which would get you the functionality required.
- If you are using KDE 4, then the programmer can use Solid, which will make the job pretty simple I imagine.
- If you are using KDE 3, then you will have to listen to HAL directly, which will make it much harder as HAL sends notifications for any hardware disconnections / connections.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
neverendingo
Administrator
Posts
2136
Karma
17
OS
I remember there was a way under KDE3. Open KControl, go to "Connected Devices" -> "Storage Media" (or something like that, i don't have the english version at hand).
Now you can add actions depending on the mimetype of the media. So it should be possible to add a shell script as action. But untested as i am not on KDE3 anymore.
Hope that helps.


New to KDE Software? - get help from Userbase or ask questions on the Forums
Communicate.
Image
ouimet
Registered Member
Posts
2
Karma
0
Thanks for the answers.

I am using 3.5. Tried a new action like suggested, but it replaced the mount with the new action instead of adding the execution of the script to the mount.

As for HAL I tried but couldn't find any doc about this solution.

Guess I will have to write a little daemon that checks /media and execute the script each time a new mount is made... Other suggestions?

Thanks again!
Daniel
User avatar
neverendingo
Administrator
Posts
2136
Karma
17
OS
For documents on HAL see this, could be helpful: http://www.redhat.com/magazine/003jan05/features/hal/


New to KDE Software? - get help from Userbase or ask questions on the Forums
Communicate.
Image


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell