10

I'd like to use Nautilus as default in XFCE instead of Thunar, but how can I remove full Thunar? I have already typed

sudo apt-get remove thunar gvfs-backends

But I still have problems because if I click on a folder in the desktop Thunar starts. Can someone help me?

Thank you.

filbranden
  • 21,113
  • 3
  • 58
  • 84
Mitro
  • 1,091
  • 6
  • 22
  • 37

3 Answers3

23
  1. Try running exo-preferred-applications from the terminal(Ctrl+Alt+t ). You should see an option to change your file manager on the 2nd tab named "Utilities".

    Change the File Manager option to "Nautilus".

  2. Using xdg-mime, You could also run the following command to determine your current default file manager:

    • xdg-mime query default inode/directory

    • In your case, this should return thunar.desktop as a result.

    • In order to change this, run:

    • xdg-mime default nautilus.desktop inode/directory application

  3. You can edit the file ~/.local/share/applications/mimeapps.list
    • look for the line containing inode/directory=thunar.desktop;
    • change it to read inode/directory=nautilus.desktop;
Kevin Bowen
  • 479
  • 1
  • 7
  • 19
  • 1
    1) worked very well for me. i did no t need to use 2) or 3) – Dee Apr 03 '13 at 09:22
  • It is possible that you also will need to perform a similar edit of `/usr/share/applications/mimeinfo.cache` under administrative rights. There remains one caveat. Links on the desktop will continue to open with Thunar. (Thunar cannot be uninstalled because of other dependant packages.) It seems that this behaviour for opening desktop links is hard-wired in XFCE 4.8. – Serge Stroobandt Aug 03 '13 at 11:24
  • @Serge - No problem here (4.10), this answer works perfectly. However, I created a custom launcher using `nautilus --no-desktop`, as I don't want Nautilus to manage the desktop, so it still uses the default desktop and works fine. – Wilf Nov 11 '14 at 23:23
  • 1.+2. worked for me for PCmanFM in ubuntu/XFCE, using `cmanfm.desktop` in the command you gave in 2. – Jonatan Öström Jul 22 '17 at 21:11
  • Thunar still has the desktop. How to let Nautilus have it? –  Nov 29 '17 at 13:46
  • With the advent of Xubuntu 20.04 LTS and the `dbus` debacle, this answer **only works after having implemented [one of these solutions](https://unix.stackexchange.com/a/581233/39845).** – Serge Stroobandt Feb 12 '21 at 11:18
11

The reason Thunar starts by default in xfce is because xfce comes out of the box already in agreement with Thunar as it's default file manager. This dependency is not written in mimetype, but rather as a dbus service.

You can test this yourself by starting this command in a new terminal:

dbus-monitor --session interface=org.freedesktop.FileManager1

In a new terminal, open a file with this command (replace /home/user/folder/or/file.ext with an actual file or folder path):

dbus-send --session --print-reply --dest=org.freedesktop.FileManager1 --type=method_call /org/freedesktop/FileManager1 org.freedesktop.FileManager1.ShowItems array:string:"file:///home/user/folder/or/file.ext" string:""

In the first terminal, you will see that the request is processed by dbus and Thunar might open.

Some briefing

Linux has no real concept of a "default" file manager - no that's a Windows artifact, or "default" handler of mimetypes for that matter. It is really all about how your system is configured.

Mimetypes are great and work about 90% of the time, but many modern applications are beginning to shift to using dbus and only fallback to mimetype-based filtering if dbus fails to find an appropriate file manager.

More specifically, there exists a dbus interface called org.freedesktop.FileManager1 which any dbus service can implement. Now whenever an application which makes use of dbus wants to open a file, they simply send a message via dbus, and dbus will completely bypass whatever mimetypes you have set in place and instead invoke the first service it finds with the name org.freedesktop.FileManager1.

Solution(s)

In fact for many of us, it may be impossible to simply uninstall Thunar, so I propose two ways of dealing with this annoyance:


  1. The first way is to simply tell dbus to block all attempts made to use org.freedesktop.FileManager1. Your applications will now be forced to use mimetypes. The way to do that is to create a file called /etc/dbus-1/session-local.conf, with the content:
<?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>

Now reload dbus with:

dbus-send --session --print-reply --dest=org.freedesktop.DBus --type=method_call /org/freedesktop/DBus org.freedesktop.DBus.ReloadConfig

After reloading dbus, every application will now be forced to either use mimetypes or fail to open a particular file.


  1. The second option is less dramatic.

Instead of blocking all org.freedesktop.FileManager1 calls, you may find that your preferred file manager implements the org.freedesktop.FileManager1 interface already and you want to force xfce to use that.

You can do this by creating a symlink from that service (in /usr/share/dbus-1/services) to $XDG_DATA_HOME/dbus-1/services/org.freedesktop.FileManager1. (XDG_DATA_HOME usually defaults to ~/.local/share)

Indeed Nautilus implements this interface. See my answer here.

Now, your favourite file manager will be used instead of the default one in xfce.


Hope that helps. Happy configuring!

References

smac89
  • 1,279
  • 1
  • 13
  • 17
  • 1
    Thank you very much! Solution 1 did the trick for launching the GTK2 [SpaceFM](http://ignorantguru.github.io/spacefm/) tabbed file manager when opening downloads in [Vivaldi](https://vivaldi.com) under Xubuntu 20.04 LTS. – Serge Stroobandt Feb 12 '21 at 11:15
  • 1
    I love you. This has been bugging me for AGES with KDE Plasma on Fedora... Chrome, VS Code, etc were all opening Elementary file explorer while I wanted Dolphin... – NotoriousPyro Dec 21 '22 at 10:01
1

Try to look at this similar question of turning your default file-manager into Nautilus:

https://askubuntu.com/questions/47208/how-to-stop-thunar-being-default-file-browser

You should be able to remove Thunar completely by running following command:

 sudo apt-get purge thunar*
aagaard
  • 126
  • 3