A link to a “similar question” (xdg-open default applications behavior – not obviously related, but some experimentation showed that the behaviour is indeed equivalent to the one of xdg-open
) led me deeper down the rabbit hole. While Firefox does not rely on, or inherit rules from, xdg-open
, it uses the MIME specification files just as xdg-open
does.
On a user basis, the MIME opening behaviour is configured by the specification file ~/.local/share/applications/mimeapps.list
.
For me, this file contains just a few reasonable protocols and HTML (and similar) files connected to userapp-Firefox-??????.desktop
, but you could easily add a line like
application/pdf=evince.desktop
to solve that problem on a per-user basis. If the file does not exist yet, make sure to add a section header, such as
[Default Applications]
application/pdf=evince.desktop
Deeper down, the mime types are defined in /usr/local/share/applications/mimeinfo.cache
(this may be /usr/share/…
if you are not on a FreeBSD system), which does list application/pdf=inkscape.desktop;evince.desktop;
. Both evince.desktop
and inkscape.desktop
in that folder contain MimeType=[…]application/pdf;[…]
.
The mimeinfo.cache
is automatically generated from the mime types listed in the .desktop
files without any well-defined order, so you will have to either remove the PDF mime type from Inkscape and regenerate the cache using update-mime-database
, or generate a mimeapps.list (either globally in /usr/local/share/applications/
, or for your user in ~/.local/share/applications/mimeapps.list
).
xdg-open is the safest bet. Not everyone will necessarily have gnome or gvfs installed. xdg-open, on the other hand, is not tied to any desktop environment or toolkit.
Best Answer
Open the Firefox menu (Click 3 horizontal bars in the Firefox menu), then click the Preferences icon. In the sidebar that appears on the left, select Applications.
If the file you are trying to open is listed there, select Always ask from the drop-down to the right of the file type. The next time you try to open the file you will be prompted for how you want the file handled. Select the correct application to use, then select Always use this program to force it in the future. If you accidentally select an application that doesn't work for the file, repeat these steps until you select a program that works with your file.
Remember, Linux uses magic numbers to determine the file type while Windows uses the file's extension. If the extension or magic number can not be used to determine the file type, you will be asked each time you attempt to open the file since Firefox will be unable to determine the correct file type.