Bug 397953 - KIO::highlightInFileManager does not respect default file manager setting when launched via FileManager1 DBus activation
Summary: KIO::highlightInFileManager does not respect default file manager setting whe...
Status: CONFIRMED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: 5.246.0
Platform: Arch Linux Linux
: HI normal
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords:
: 395616 413974 418052 421684 423411 461828 482515 487630 508241 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-08-27 21:26 UTC by Patrick Silva
Modified: 2025-08-14 14:54 UTC (History)
31 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2018-08-27 21:26:25 UTC
I have nautilus file manager installed on my system, dolphin is configured as default file manager in system settings > applications > default apps > file manager.

When I press shift+printscreen to take a screenshot, plasma shows a notification.
I right click the screenshot thumbnail in the notification, I select "Open containing folder" and nautilus opens instead (default) dolphin.
Comment 1 Kai Uwe Broulik 2018-08-28 07:03:44 UTC
This uses the FileManager1 DBus interface and there can be only one that claims it, which seems to be Nautilus in your case. Uninstall Nautilus, I suppose.
Comment 2 Patrick Silva 2018-08-28 10:42:22 UTC
I need nautilus because dolphin has some problems with samba shares.
Comment 3 David Edmundson 2018-08-28 11:02:58 UTC
As a workaround, one can copy 

/usr/share/dbus-1/services/org.kde.dolphin.FileManager1.service

to

~/.local/share/dbus-1/services/org.freedesktop.FileManager1.service

(note the filename change is also important)

It would be nice if you can confirm if that works.
Comment 4 Patrick Silva 2018-08-28 20:33:43 UTC
(In reply to David Edmundson from comment #3)
> As a workaround, one can copy 
> 
> /usr/share/dbus-1/services/org.kde.dolphin.FileManager1.service
> 
> to
> 
> ~/.local/share/dbus-1/services/org.freedesktop.FileManager1.service
> 
> (note the filename change is also important)
> 
> It would be nice if you can confirm if that works.

Your workaround worked after reboot.
Thank you David.
Comment 5 Nate Graham 2018-08-28 20:35:12 UTC
Could the "default file manager" UI force the chosen app to be the one that exports the FileManager1 DBus interface (if it's capable of that)?


> I need nautilus because dolphin has some problems with samba shares.
More fallout from not having either
- Bug 75324
or
- Bug 40115
- Bug 397742
- Bug 358368
- Bug 344146
- Bug 345135
- Bug 356651
- Bug 204323
- Bug 302448
- etc...
Comment 6 David Edmundson 2018-08-28 22:47:29 UTC
>Could the "default file manager" UI force the chosen app to be the one that exports the FileManager1 DBus interfac

In a way.

Very new DBus daemon also sources  XDG_RUNTIME_DIR/dbus-1/services

Becuase it's transient, we can special case exporting the relevant file manager there in some kcminit hook like the workaround above. 

But it's more complex. If we exported krusader like that, it would get activated, not register the bus name and the calling client would sit around not getting a reply...
We can't use a custom desktop file tag as we need it in nautilus...

---

I don't understand the relevant of that list of other bug reports?
Comment 7 Patrick Silva 2018-09-16 20:24:09 UTC
*** Bug 395616 has been marked as a duplicate of this bug. ***
Comment 8 David Edmundson 2019-11-10 16:48:35 UTC
*** Bug 413974 has been marked as a duplicate of this bug. ***
Comment 9 Patrick Silva 2020-01-21 13:06:56 UTC
This annoying problem persists.

Each time I use "open containing folder" feature of Firefox, my system opens a different app: sometimes Dolphin (default file manager), sometimes nautilus, sometimes  a random app (FFaudioConverter on my system). :(

Operating System: Arch Linux 
KDE Plasma Version: 5.17.90
KDE Frameworks Version: 5.66.0
Qt Version: 5.14.0
Comment 10 David Redondo 2020-02-22 19:26:25 UTC
*** Bug 418052 has been marked as a duplicate of this bug. ***
Comment 11 Méven Car 2020-03-10 07:59:57 UTC
(In reply to Nate Graham from comment #5)
(In reply to David Edmundson from comment #6)
> >Could the "default file manager" UI force the chosen app to be the one that exports the FileManager1 DBus interfac
> 
> In a way.
> 
> Very new DBus daemon also sources  XDG_RUNTIME_DIR/dbus-1/services
> 
> Because it's transient, we can special case exporting the relevant file
> manager there in some kcminit hook like the workaround above. 
> 
> But it's more complex. If we exported krusader like that, it would get
> activated, not register the bus name and the calling client would sit around
> not getting a reply...
> We can't use a custom desktop file tag as we need it in nautilus...

Currently the File manager setting in componentchooser kcm, makes the selected file manager associated with mimetype inode/directory.
The kcminit hook could just pick up this setting and apply it to $XDG_RUNTIME_DIR/dbus-1/services for file managers where there is a corresponding "[D-BUS Service]
Name=org.freedesktop.FileManager1" service defined, excluding krusader and other File manager with no org.freedesktop.FileManager1 DBUS support, removing the transient file a the end of the session.

Relevant spec:
https://dbus.freedesktop.org/doc/dbus-daemon.1.html

We are not the only ones dealing with the situation:
https://bugzilla.redhat.com/show_bug.cgi?id=1394927
Comment 12 David Edmundson 2020-03-10 17:52:28 UTC
>The kcminit hook could just pick up this setting and apply it to $XDG_RUNTIME_DIR/dbus-1/services for file managers where there is a corresponding "[D-BUS Service]

Sure, but how do we check there's a corresponding thing defined?

The service file name is free text and typically won't match the application name.

If we want to do that we'll need to define a standard desktop wide to have a common naming scheme there.
Comment 13 Méven Car 2020-03-11 09:44:06 UTC
As a minimum we could enforce this for dolphin whose service filename is well known by ourselves "org.kde.dolphin.FileManager1.service".
Comment 14 Patrick Silva 2020-05-17 19:30:05 UTC
*** Bug 421684 has been marked as a duplicate of this bug. ***
Comment 15 Patrick Silva 2020-06-24 04:25:27 UTC
*** Bug 423411 has been marked as a duplicate of this bug. ***
Comment 16 Nate Graham 2022-11-15 18:46:30 UTC
*** Bug 461828 has been marked as a duplicate of this bug. ***
Comment 17 Nate Graham 2024-03-06 17:55:15 UTC
*** Bug 482515 has been marked as a duplicate of this bug. ***
Comment 18 Eugene Shalygin 2024-03-14 08:01:48 UTC
Unless Dolphin is running (and there is no FileManager1 service on the session bus), KIO::highlightInFileManager() opens a new nautilus. inode/directory mime-type is set to Dolphin, while the xdg-open utility opens Dolphin.

I'd be  happy if setting the default file application overwrite /usr/share/dbus-1/services/org.freedesktop.FileManager1.service.
Comment 19 Nate Graham 2024-06-12 19:09:05 UTC
*** Bug 487630 has been marked as a duplicate of this bug. ***
Comment 20 medin 2024-07-22 17:23:47 UTC
Even one of Mozilla folks is suspecting the bug in KDE Plasma.
https://bugzilla.mozilla.org/show_bug.cgi?id=1897300
Comment 21 Fabian Vogt 2024-07-22 18:18:12 UTC
> But it's more complex. If we exported krusader like that, it would get activated, not register the bus name and the calling client would sit around not getting a reply...

That should be easy to filter out based on the available .service files. /usr/share/dbus-1/services/org.kde.dolphin.FileManager1.service contains:

> [D-BUS Service]
> Name=org.freedesktop.FileManager1
> Exec=/usr/bin/dolphin --daemon
> SystemdService=plasma-dolphin.service

i.e. it needs to be Name=org.freedesktop.FileManager1 to be a viable option for org.freedesktop.FileManager1.service. To find out whether the .service matches the selected handler for x-inode/directory, compare Exec=?

This also needs to be fixed in nautilus. Providing /usr/share/dbus-1/services/org.freedesktop.FileManager1.service unconditionally means it's not coinstallable with any other file manager. Either all of them provide this file or none do, everything else is broken one way or the other.
Comment 22 Grósz Dániel 2024-11-19 21:23:46 UTC
(In reply to Méven Car from comment #11)
> Currently the File manager setting in componentchooser kcm, makes the
> selected file manager associated with mimetype inode/directory.
> The kcminit hook could just pick up this setting and apply it to
> $XDG_RUNTIME_DIR/dbus-1/services for file managers where there is a
> corresponding "[D-BUS Service]
> Name=org.freedesktop.FileManager1" service defined, excluding krusader and
> other File manager with no org.freedesktop.FileManager1 DBUS support,

Another option would be for KDE to unconditionally provide a DBus service that just launches the file manager selected by the user. That would also support file managers that don't provide a systemd service file, even if it's a custom command specified by the user. I don't see why it should be the job of every file manager to implement a daemon mode and provide a service file in order to be usable as a default file manager in some contexts.

I guess the purpose of a daemon mode is slightly faster startup? If so, KDE could use the file manager's service file for known file managers (at least Dolphin and whatever is the system-wide default in /usr/share/dbus-1/services/org.freedesktop.FileManager1.service), and use a generic daemon that launches the selected default file manager otherwise.
Comment 23 Jonathan Marten 2024-11-20 10:24:51 UTC
(In reply to Grósz Dániel from comment #22)
> Another option would be for KDE to unconditionally provide a DBus service
> that just launches the file manager selected by the user.

I had prototyped a KDED module to do that some time ago, to launch the user's preferrred file manager for this DBus service.  It has been tested with Dolphin and Konqueror, and should in theory work with Nautilus or any other file manager as long as it supports the standard command line options.   Code is at https://github.com/martenjj/filemanager-kded if anyone would like to try it out.
Comment 24 TraceyC 2025-03-24 16:05:33 UTC
This persists in Plasma 6.3.3 and git-master
Comment 25 Nate Graham 2025-08-14 14:54:00 UTC
*** Bug 508241 has been marked as a duplicate of this bug. ***