How to add custom menu items in Dolphin (KDE Plasma)
You can easily create custom items for the contextual menu on Dolphin to execute scripts on files.
A new “Actions” item
Create a .desktop
file inside /usr/share/kservices5/ServiceMenus/
(e.g.: copyTextContent.desktop
) and add this content to the file:
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KonqPopupMenu/Plugin,<mimetype>
: replace<mimetype>
with the MIME types of the files in which you want the custom menu item appears. For example, for text files addtext/*
. You can add several MIME types (separated by commas).-
Actions=<action name>
: replace<action name>
with a name for the desktop action (e.g.:Myaction
) [Desktop Action <action name>]
: after a blank line, add this and replace<action name>
with your chosen desktop action name.Name=<item name>
: replace<item name>
with the name for the menu item.Exec=<command>
: replace<command>
with the command you want to execute. To refer to the file, add%U
as a command argument.Icon=<icon name>
: you can optionally add an icon.
This is an example (copies the content of a text file to the clipboard, requires xclip
):
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KonqPopupMenu/Plugin,text/*
Actions=Copytext
[Desktop Action Copytext]
Name=Copy Text Content
Exec=xclip -selection clipboard %U
Save the file and the menu item will appear inside Actions
section in the contextual menu.
A new “Create New” item
You can also add menu items inside the “Create New” menu. Create a .desktop
file inside /usr/local/share/templates
. and add this content:
[Desktop Entry]
Name=<item name>
Comment=<a description>
Type=Link
URL=<full path to the template file>
: create a blank file (which will be used as a template) and add its full path.
For example, to create a “New LibreOffice Writer document” item:
[Desktop Entry]
Name=New LibreOffice Writer document
Comment=A comment
Type=Link
URL=/home/user/MyTemplates/mytemplate.odt
If you have any suggestion, feel free to contact me via social media or email.
Latest tutorials and articles:
Featured content: