Is it possible to restrict a Dolphin service menu to a specific location/path?

I like very much the recent files (recentlyused:/files/) and recent locations (recentlyused:/locations/) access in Dolphin —and also in the Transparent Folder view widget—, but there is no option to “go to target” or “open containing folder” option for recent files.

I would like to add a service menu for that (containing Exec=dolphin %d), but can I make it appear only for the location recentlyused:/files/ — because having that appearing at the location Dolphin already is makes little sense — ?

I provided you with such an option in another topic. You need to asign a shortcut for it in dolphin and emulate that in the servicemenu with xdotool.

I am sorry, but I don’t yet see the connection between getting missing services to appear on the desktop and stopping a service from appearing in all but recentlyused:/files/.
Could you please post a bit more on that?

I don’t really understand your question. From what I understand you want certain servicemenus to only appear in certain directories? Don’t think that’s possible. But if it’s some sort of “open the containing directory” you’re looking for…You could add an action or a separate servicemenu with exec= dolphin --select “$(realpath %f)”. That would open the file ( if it still exists of course) in a new dolphin tab with the file highlighted.
Unless there is such a possibility which I overlooked, the only “restriction” you can set on a servicemenu is by mime, not directory.

1 Like

Yes, that is what I’m asking. I know how to add an option to open a file’s location but I only need it in recentlyused:/files/. It now appears everywhere, and in most cases is useless.

Like I said, might be missing something but I don’t think it’s possible. If the “open location” is always in your view, everywhere and mostly useless, your best bet is to kinda bundle a few service actions so that you’ll only find it in a submenu, out of sight.

1 Like

Thank you for the prompt intervention, effort and good intentions! All the best to you!

In order for that to work (in Kubuntu) I had to remove the inverted commas (or use Exec=dolphin --select $(realpath "%f"), otherwise it gave an error. But dolphin --select %f works also.

Dolphin co-maintainer here.

I am happy to heard that, I implemented it.

but there is no option to “go to target” or “open containing folder” option for recent files.

It would be very simple to add. I thought it was there. Adding it Add open containing folder options for files in recentlyused:/ (!616) · Merge requests · System / Dolphin · GitLab

I would like to add a service menu for that (containing Exec=dolphin %d), but can I make it appear only for the location recentlyused:/files/ — because having that appearing at the location Dolphin already is makes little sense — ?

That’s possible, you can follow the documentation Creating Dolphin Service Menus | Developer and set “X-KDE-Protocols” to “recentlyused” with “MimeType” “application/octet-stream”.

4 Likes

Excellent! Thank you!

Any Idea why using this service menu opens a new Dolphin window instead of a new tab?

[Desktop Action path]
Exec=dolphin --select %f
#Exec=dolphin --select $(realpath "%f")
Icon=find-location-symbolic
Name=Open target location

[Desktop Entry]
Actions=path
MimeType=application/octet-stream;inode/directory
ServiceTypes=KonqPopupMenu/Plugin
Type=Service
X-KDE-Priority=TopLevel
X-KDE-Protocols=recentlyused

This was solved by the maintainer: Is it possible to restrict a Dolphin service menu to a specific location/path? - #10 by meven

Any Idea why using this service menu opens a new Dolphin window instead of a new tab?

use dolphin --new-window --select %f

Btw you can use --help option with most commands from the command to get their options. I.e dolphin --help

I guess that would be if I wanted a new window, but that happens already, even without that option. I expected a new tab, but a new window is opened with just Exec=dolphin --select %f.

I guess that would be if I wanted a new window, but that happens already, even without that option. I expected a new tab, but a new window is opened with just Exec=dolphin --select %f.

This depend on a option in dolphin. “Keep a single dolphin window, opening new folders in tabs”

1 Like

That’s it, thank you!

Sorry, are you referring to my service menu? I don’t really get what kind of search. Or are you addressing meven on a different topic?

Never mind. I’ll delete the post.

if i got it right … this is going to get implemented in dolphins source.

is there any reason, why it is done that way and not implemented as a service menu (and distributed by default) instead?

the same question drives me with the Ark menu extension.

We don’t ship service menus by default, all service menus are for users to install and use.

This allows more integration within dolphin, like how to position the action in the context menu.
Also it is slightly more efficient (no external to read parse, etc) but that’s not much of a concern in this case.
It still is user-configurable.

Same answer for ark.

Hi! Could you take a look at this post about how recentlyused:/files as a “location” in a widget only shows modified files (instead of used ones)?