Reply to topic

getting the path from dolphin->contextmenu->actions

Registered Member
Hi there,

please excuse my maybe not perfect english. Also i work in a german setup, so hopefully all transcriptions are correct.

For my daily work i want to create a context-menu entry for directories that calls a shellscript.
I created the .desktop-file in
and i get my script called via right-click->context-menu->actions->etc... , so this part works.
For testing purposes i just echo things out to the terminal and a .txt-file.
Here is the .desktop-entry:
Code: Select all
[Desktop Entry]

[Desktop Action quer_Kunden_GA]
Name=Links Kunden-GA
Name[en]=links Kunden-Gutachten
Exec=/bin/bash -c "sh /home/frank/bin/kde/querlinks/"

>...and the other entrys, but i use this first one for testing...<

and here the called shell-script:
Code: Select all
echo "PWD ist "$PWD
echo "u ist str 0 1 2  "$0  $1  $2 $u %u
echo "PWD ist "$PWD >> /home/frank/bin/kde/querlinks/text.txt
echo "u ist str 0 1 2  "$0  $1  $2 $u $%u >> /home/frank/bin/kde/querlinks/text.txt

read -p "Eingabe " input

The "read -p ..." line is for keeping the terminal open, for this i tried
Exec=konsole -e /bin/bash --rcfile /home/frank/bin/fsync/sisd &
"echo ... $u %u" was for trying just anything.

As expected i get
Code: Select all
PWD ist /home/frank/.local/share/kservices5
as $PWD, which i actually don´t need to work on further with.
Also i get $0,
Code: Select all
u ist str 0 1 2  /home/frank/bin/kde/querlinks/ %u
which is path and name of my shellscript (plus "%u", so this didn´t work).

But i did not manage to get the path from where i called the
I tried any iteration of using sh or bash, with or without ' " ' on different places and so on.

I followed this tutorial, telling
If you have a complex task that requires more than one command (for example if we wanted to copy the image file somewhere first and then use D-Bus to set it as the background) use a shell:

Exec=/bin/sh -c ";<YOUR COMMANDS HERE>"

also inserting the " ; " inside the ' " ', then nothing at all happened.

After hours of trying i urge for solution... how can i use the desired variable, which is reffered to as
for use with d-bus, in my shellscript?

Thanks in advance, i appreciate any help,


Reply to topic


Who is online

Registered users: andrewm, Baidu [Spider], Bing [Bot], buddyt, funix, Google [Bot], ssanderson, Yahoo [Bot]