Folders not opening with Nautilus - Arch Linux

How to set nautilus as the default folder handler after an installed program messes the config up.

Introduction

For years, there have been posts scattered across the internet from users who, after an update or installation of certain key packages in Arch Linux, have noticed that folders (especially icons on the desktop) do not open with Nautilus but with another program. In particular, there have been many mentions (and it was also my case) of folders opening with VS Code.

All of this stems from the configuration of gio mime.

Solution

To see which programs are listed to open directories, we enter the following command: gio mime inode/directory

This will return a response similar to this:

1
2
3
4
5
6
7
8
[spork@larc ~]$ gio mime inode/directory
Default application for “inode/directory”: code.desktop
Registered applications:
	code.desktop
	org.gnome.Nautilus.desktop
Recommended applications:
	code.desktop
	org.gnome.Nautilus.desktop

To choose an option as the default: gio mime inode/directory <application>

For example:

1
2
[spork@larc ~]$ gio mime inode/directory org.gnome.Nautilus.desktop
Set org.gnome.Nautilus.desktop as the default for inode/directory
Amb <3 des de Barcelona
Built with Hugo
Theme Stack designed by Jimmy