You are not logged in.

jetpeach

Beginner

  • "jetpeach" started this thread

Posts: 27

Location: Seattle

  • Send private message

1

Thursday, September 14th 2006, 8:27pm

howto run bash script from new media detected dialog

This seems like it should be so simple, i think i'm just missing some command.
When i plug my ipod in, i would like the dialog that shows up to list a choice where one is to run a script i wrote (it syncs my google calendar to my ipod). So i go in Kcontrol and go to storage media->notifications, and add a new notification where the command is "/home/jet/myscript.sh" where my script resides. now if I hit alt-f2 (run command dialog in kubuntu) and type this command exactly then the script runs fine and all is good, but when i choose the option and it runs from the media load menu, I get
"Error - KIOExec
/media/ipod is a folder, but a file was expected"
and just have to hit ok.

This is so strange to me, why doesn't the script run just like when i double click it or when i run it in the terminal, or when i run it from the kde command dialog?! arg

so, i tried adding the following before the command:
kdesu /hoem/jet/scriptname.sh
bash /home/jet/scriptname.sh
kdesu -u jet scriptname.sh
kdesu -u jet scriptname.sh

same error all the time.

anyway, if somebody can help that would be great!
thanks,
jet

This is also posted at the ubuntuforums.org, but there was no response there (posted 5 days ago).
http://www.ubuntuforums.org/showthread.php?t=253222
And it is posted at the kubuntu forums
http://kubuntuforums.net/forums/index.php?topic=8964.0
but still no answer there either. please help and i'll post the answer on those other threads as well!
My Zoji homepage
http://www.zoji.com/jet

This post has been edited 1 times, last edit by "jetpeach" (Sep 14th 2006, 8:27pm)


jetpeach

Beginner

  • "jetpeach" started this thread

Posts: 27

Location: Seattle

  • Send private message

2

Saturday, September 16th 2006, 8:08am

bump! anybody help on this? i've posted in three forums now, it seems like it should be soooo simple.
My Zoji homepage
http://www.zoji.com/jet

bram85

Professional

Posts: 948

Location: Eindhoven

Occupation: Software Engineer

  • Send private message

3

Sunday, September 17th 2006, 10:28am

RE: howto run bash script from new media detected dialog

Haven't tested this, but try this. Create a doyourthing.desktop file in ~/.kde/share/services with the following contents:

Source code

1
2
3
4
5
6
7
8
9
10
[Desktop Entry]
ServiceTypes=media/cdrom_mounted,media/cdrom_unmounted,media/cdwriter_mounted,media/cdwriter_unmounted,media/dvd_mounted,media/dvd_unmounted,media/audiocd,media/blankcd,media/blankdvd,media/dvdvideo,media/svcd,media/vcd
Actions=DoYourThing;
X-KDE-Priority=TopLevel
X-KDE-MediaNotifierHide=true

[Desktop Action DoYourThing]
Name=Do Your Thing
Name[nl]=Doe je ding
Exec=/path/to/bin/doyourthing.sh %u


Eventually, you need to run kbuildsycoca (as your own user) before the changes take effect.
Bram Schoenmakers
KDE Netherlands (www.kde.nl)

jetpeach

Beginner

  • "jetpeach" started this thread

Posts: 27

Location: Seattle

  • Send private message

4

Sunday, September 17th 2006, 9:20pm

thank you very much, i'll try this soon!
My Zoji homepage
http://www.zoji.com/jet

jetpeach

Beginner

  • "jetpeach" started this thread

Posts: 27

Location: Seattle

  • Send private message

5

Saturday, October 7th 2006, 11:07pm

well i tried playing around with these desktop files to get this to work, couldn't figure it out.
can anybody give an easier solution to this? it just don't get why it complains at all, what's the difference between executing a program and executing a script? why shouldn't the storage media handler be able to do both?
My Zoji homepage
http://www.zoji.com/jet