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 (show other bugs)
Version: 5.246.0
Platform: Arch Linux Linux
: HI normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
: 395616 413974 418052 421684 423411 461828 482515 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-08-27 21:26 UTC by Patrick Silva
Modified: 2024-03-14 08:01 UTC (History)
20 users (show)

See Also:
Latest Commit:
Version Fixed In:


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.