You are not logged in.

#1 2020-05-16 14:49:30

ffcc
Member
Registered: 2013-09-10
Posts: 6

[SOLVED] Chromium bypassing default file manager in XFCE

Hi,

I have been running across this problem for a while now and it is driving me crazy.

The problem is that the "Show in Folder" button of the Chromium Downloads page would bypass my default file manager (spacefm) and open Thunar instead. I'm running XFCE btw.

The mimetype "inode/directory" is already set as "spacefm" but still was being bypassed by chromium.

Apparently chromium is using Dbus to choose the filemanager instead of calling xdg-open.

There is a workaround to that in the next post:

https://unix.stackexchange.com/question … lt-in-xfce

I tried the "drastic" solution, that's to say telling dbus to block all attempts made to use org.freedesktop.FileManager1 by adding /etc/dbus-1/session-local.conf, and it worked:

 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">

<busconfig>
  <policy context="default">
    <!-- Block all usage of org.freedesktop.FileManager1 for opening files -->
    <deny send_interface="org.freedesktop.FileManager1" send_destination="org.freedesktop.FileManager1"/>
  </policy>
</busconfig> 

I was however not able to use the trick of linking dbus services. I seem not to have an "org.freedesktop.FileManager1.service" in /usr/share/dbus-1/services/. I do have "org.xfce.FileManager.service" and "org.xfce.Thunar.FileManager1.service" but editing or deleting those would make no difference (Thunar was still being opened instead of spacefm).

It's weird, I really dont know what is happening under the hood. The drastic solution works but xdg-open is not being called (I know that, because I edited /usr/bin/xdg-open so that a file is touched whenever it is called). So I really don't know how the filemanager is being picked...

Last edited by ffcc (2020-05-17 15:38:53)

Offline

#2 2020-05-17 14:13:33

Annoyingduck
Member
Registered: 2016-08-02
Posts: 179

Re: [SOLVED] Chromium bypassing default file manager in XFCE

Is it definitely Thunar opening or is it the GTK file browser opening (which has characteristics of Thunar, but ultimately more like Nautilus)? On my installs, that's what opens, no matter what my default file manager is.

Offline

#3 2020-05-17 15:07:14

glitsj16
Member
Registered: 2015-04-26
Posts: 116

Re: [SOLVED] Chromium bypassing default file manager in XFCE

Have you tried creating /etc/dbus-1/services/org.freedesktop.FileManager1.service and pointing that to spacefm? That file is owned by nautilus, but perhaps you don't even have to install it to get what you want.

$ pkgfile /usr/share/dbus-1/services/org.freedesktop.FileManager1.service
extra/nautilus

$ cat /etc/dbus-1/services/org.freedesktop.FileManager1.service
[D-BUS Service]
Name=org.freedesktop.FileManager1
Exec=/usr/bin/spacefm <whatever-arguments-you-need>

Last edited by glitsj16 (2020-05-17 15:09:21)

Offline

#4 2020-05-17 15:37:34

ffcc
Member
Registered: 2013-09-10
Posts: 6

Re: [SOLVED] Chromium bypassing default file manager in XFCE

It is definitively Thunar and not the Gtk File Chooser ("About" tab clearly shows it is Thunar).

OTH, when I try to save a web page ("Save As") I do get Gtk File Chooser (which is similar but not the same).

Besides, the trick of blocking calls to FileManager1 interface worked as expected: "Show in Folder" now opens my default spacefm but "Save As" still opens Gtk File Chooser (as it should be).

I have been reading about DBus and I get now that linking to a spacefm DBus service (by adapting one of the existing ones) won't work because spacefm does not implement this (Thunar does, via "--gapplication-service" flag). Code should be written for this to work.

It looks like both "/usr/share/dbus-1/services/org.xfce.Thunar.FileManager1.service" and "org.xfce.FileManager.service" implement "org.freedesktop.FileManager1" (I can check that much with "d-feet", the three paths seem to be the same in reality as they have the same uuid).
When "Thunar --gapplication-service" is run these services are set up.

Btw, I double checked whether xdg-open was called or not (after blocking  org.freedesktop.FileManager1 calls) and it turns out IT IS INDEED CALLED. I used the same trick as before (touching a file), I don't know what happened. When I did this yesterday, calling xdg-open from the console did create the file so the line I added was in the right spot whitin the file.

I am going to mark this as SOLVED.

Last edited by ffcc (2020-05-17 15:39:34)

Offline

Board footer

Powered by FluxBB