In windows, you can and context menu entries that are only shown for specific file types only.
In Dolphin, I know how to add service menu entry using .desktop file. but Is there way to only show those service menus for specific file type?
Under the section
[Desktop Entry] should be the line that specifies the type of file for which that appears:
To limit that to mp4 files, it should be
MimeType=video/mp4. To restrict to all videos:
MimeType=video/*; to videos AND folders:
Also under the section
[Desktop Entry] you need to have
Application) and the line
Actions=, where you have to specify the name or names of the action or actions of the service menu, each action being a separate section of this file with a separate
name, of the form
[Desktop Action name].
Exec= line is to be set under each
[Desktop Action name] section (NOT under
Here is an example with multiple actions.
[Desktop Entry] Type=Service Name=Download subtitles (filebot) ServiceTypes=KonqPopupMenu/Plugin Actions=en;fr;ro;it; MimeType=video/*;inode/directory; Icon=gnome-subtitles Encoding=UTF-8 X-KDE-Priority=TopLevel X-KDE-Submenu=Subtitles [Desktop Action en] Exec=filebot -get-subtitles -rename -non-strict %f Icon=gnome-subtitles Name=English (filebot) Termial=true [Desktop Action fr] Exec=terminator -e "filebot -get-subtitles --lang fr -rename -non-strict %f" -p ttt Icon=gnome-subtitles Name=Français (filebot) [Desktop Action ro] Exec=terminator -e "filebot -get-subtitles --lang ro -rename -non-strict %f" -p ttt Icon=gnome-subtitles Name=Româneşte (filebot) [Desktop Action it] Exec=terminator -e "filebot -get-subtitles --lang it -rename -non-strict %f" -p ttt Icon=gnome-subtitles Name=Italiano (filebot)
which will give this for videos and directories:
You may have one or multiple actions.
Other settings under
X-KDE-Priority=TopLevel will show the action (or its group: see below) directly in the menu, like in the image above; without that, it will be under 'Actions' group.
X-KDE-Submenu=something will group under one menu-group called 'something' all the actions from files that have that line in them. (Even if the actions are in different service menu files, as discussed in this question; also see this question.)