Introduction
Hey fellow Devs, it's Ritika here.
I recently installed Gnome Shell as my Window Manager on my Linux environment, and some of my default settings got changed as a result. One of them is Firefox not opening the downloaded file location in File Manager, instead trying to open it in FreeCAD, a parametric 3D modeler software.
The problem
Unfortunately, this is not something you can configure in the General settings in Firefox.
Why it happens (MIME types)
There's more to opening a file than just knowing its extension and the default application you've set it to open with.
A MIME type (Multipurpose Internet Mail Extensions type) indicates the nature and format of a document, file, or assortment of bytes. (Source: MDN)
In Linux, these MIME types are commonly defined in a file mimeinfo.cache
.
A MIME type has two parts: a type and a subtype, separated by a slash (/). It is accompanied by a value on the right side of the equals (=) sign.
type/subtype=value
Examples:
text/plain=featherpad.desktop;libreoffice-writer.desktop;
video/mp4=vlc.desktop;
As you can see, there can be multiple values after the equals (=) sign, which are separated by semicolons (;).
The values are written in an order of priority: since featherpad.desktop
is before libreoffice-writer.desktop
, FeatherPad receives more importance and hence if it is installed, files of MIME type "text/plain
" will always be opened with FeatherPad.
If someone were to uninstall FeatherPad from their system, Libreoffice Writer
will now be given preference to open files of the same MIME type.
Our issue
In our case, we are unable to open Folder location in File Manager, instead it opens in an app called FreeCAD.
Directories have the MIME type of inode/directory
, so we'll look for this in our mimeinfo.cache
file.
The solution
Open up your terminal, and execute the following commands:
cd /usr/share/applications
sudo nvim mimeinfo.cache
If you do not have nvim
installed, you can also use gedit
or vi
to open the file with:
sudo gedit mimeinfo.cache
Sure enough, the first value for inode/directory
is FreeCAD.desktop
. We need to remove it, so that pcmanfm-qt.desktop
can have the most priority for our folder opening actions.
Save and close the file using :wq
if you're using nvim or vim.
Why sudo?
If we don't access the file with root permissions, the file stays read-only for us, hence even if we open the file and make changes, we won't be able to save our changes.
sudo
enables us to make changes to mimeinfo.cache
and save it.
Finally
After you save the file, the change should take effect even without logging out or restarting your PC. Still it's good to restart and see if our changes stick.
In case you've edited the mimeinfo.cache
file and changes still don't take place, remove the MimeType of inode/directory
after opening the Application's desktop file from the same directory, for example
sudo nvim FreeCAD.desktop
and saving the changes.
Did you find this useful? Comment below if you did, or if you faced any difficulty, let me know below. Wishing you a productive day ahead!
Top comments (1)
Just wanted to say thanks! This worked like a charm!