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

KDE 4 service menu and the shell script code

Tags: None
(comma "," separated)
gauthma
Registered Member
Posts
21
Karma
0
I found a very cool service menu script that allows to take the full path of any file and place it on klipper. It does so like this:

Code: Select all
Exec=qdbus org.kde.klipper /klipper setClipboardContents %U

But I wanted to take the path, and escape any whitespaces. So I tried modifying it in various different ways, but to no avail. The latest of which is:

Code: Select all
Exec=qdbus org.kde.klipper /klipper setClipboardContents "`echo %U | sed -e's/ /\\\ /g'`"

Now this works on the command line, placing a backslash before all whitespaces (and putting the result in klipper). But for some reason, it does not work in the service menu: every time I use it, nothing is copied. I also tried putting the whole command inside an "/bin/sh -c" but that does not work because I need to escape the doublequotes, and then using the service menu in Dolphin gives an error complaining of a malformed command.

So, in face of this, does anyone have some suggestion about accomplishing my goal?

Thanks in advance.

EDIT: I originally found the script here: http://kde-apps.org/content/show.php/copy_path?content=101854


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], mesutakcan, Sogou [Bot]