0

In running XFCE In Dolphin I wish to have a right click context menu, says myPythonScript, that will run the python script with directory and path as python sys.argv[1], sys.argv[2]

In Thunar to run it, I created a customs action as:

python myPythonScript %d %n

How can I do that under Dolphin?

I tried under .local/share/kservices5/ServiceMenus/

to create a file called righClickTest.desktop

which content is:

[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KonqPopupMenu/Plugin
MimeType=all/all;
Actions=rightClick;
Encoding=UTF-8

[Desktop Action rummage]
Name=rightClick
Exec=python <pathToMyScript> %d %n 

But I do not see my rightclick menu.

Thanks

1 Answer 1

1

You were close.

Custom Desktop Entries (.desktop) go in ~/.local/share/applications to be available to just the user.

Or /usr/local/share/applications for them to be available system-wide. Package managers use /usr/share/applications.

More info at https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

This will make your .desktop entry available in dolphin's Open With context menu or the Application Launcher (start menu).

As for the .desktop file, The simplest form is:

[Desktop Entry]
Name="name"
Type="Application"
Exec=command %U

The Type needs to be "Application" to use the Exec key.

%U is a list of URL(s) or file(s). This would be your argument(s) for the python interpreter command. You could maybe pass the working directory as the second argument but you should probably also add Path=path/to/working/directory to the .desktop file.

More info at https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .