Welcome, Guest. Please login or register.
April 17, 2014, 14:30:13 PM
Home Help Search Calendar Login Register
Show unread posts since last visit.
News: Let Pardus-Anka become #1: Pardus-Anka Bug ReportPardus-Anka World Google+ | The Pardus wiki  | Visit Pardus-Anka official website  | Register as forum member?  Email the moderator!

+  Pardus Worldforum
|-+  Assistance
| |-+  Software
| | |-+  Adding shell script to the servicemenu in konqueror?
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: Adding shell script to the servicemenu in konqueror?  (Read 867 times)
MitraMai
Pardus fellow craft
**
Gender: Male
Posts: 89


View Profile
« on: September 19, 2008, 23:50:50 PM »

I have created a small script to use when I watch a movie on my TV. But I would like to add it to the pop- up menu in konqueror. I have gotten so far that I have managed to understand what to do in theory...
This is how it looks like:

WatchAMovie.desktop

[Desktop entry]
Actions=SeFilm.sh
Encoding=UTF-8
ServiceTypes=video/*



[Desktop Action WatchAMovie]
Name=WWatchAMovie
Exec=/bin/sh "home/martin/bin/WatchAMovie"

The script it self works but I can't get the option to show up in the pop-up menu!

Does anyone have an idea?
Logged

HP nc4010, which I love dearly...
lashni
Pardus fellow craft
**
Gender: Male
Posts: 53


View Profile
« Reply #1 on: September 22, 2008, 12:51:54 PM »

I might be reading it wrong... but presuming SeFilm.sh is actually the script you're wanting to call and WatchAMovie isn't, it's kinda backwards.

From a quick glance at http://developer.kde.org/documentation/tutorials/dot/servicemenus.html it looks like it should be:

WatchAMovie.desktop

[Desktop Entry]
Actions=WatchAMovie
Encoding=UTF-8
ServiceTypes=video/*

[Desktop Action WatchAMovie]
Name=Watch a movie
Exec=/bin/sh "home/martin/bin/SeFilm.sh"

... or something like that. If I'm completely wrong feel free to call me an idiot. :)

EDIT: You'd then have to look at passing it the variable for the filename I presume... and handling that arg in your shell script.
« Last Edit: September 22, 2008, 12:55:32 PM by lashni » Logged
lashni
Pardus fellow craft
**
Gender: Male
Posts: 53


View Profile
« Reply #2 on: September 22, 2008, 15:04:37 PM »

Had a play, this all works... basically you right-click on a video file, select actions/test script, it passes the full path and filename to the bash script... which then echos that variable to the file tmp.txt. Hope it's helpful.

mkdir ~/.kde/share/apps/konqueror/servicemenus

~/.kde/share/apps/konqueror/servicemenus/testScript.desktop

[Desktop Entry]
ServiceTypes=video/*
Actions=runTest

[Desktop Action runTest]
Name=test script
Exec=/home/lashni/test.sh %u

~/test.sh

#!/bin/bash
echo ${1} > tmp.txt

EDIT: Forgot to add, chmod +x the ~/test.sh file... obvious anyway.
« Last Edit: September 22, 2008, 15:10:36 PM by lashni » Logged
MitraMai
Pardus fellow craft
**
Gender: Male
Posts: 89


View Profile
« Reply #3 on: September 22, 2008, 20:38:29 PM »

Well, well... Seems like I messed up a bit... You're quiet right lashni. Thing is SeFilm.sh is the name of my script, it's WatchAMovie in english. Just forgot to translate that part:) But it was the other part I was interested in. The Actions=runTest (without .sh) and %u. I will test it later in the week.

Thanks in advance
Logged

HP nc4010, which I love dearly...
lashni
Pardus fellow craft
**
Gender: Male
Posts: 53


View Profile
« Reply #4 on: September 23, 2008, 02:33:05 AM »

Cool, let us know how it works out. :)
Logged
Pages: [1] Go Up Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!