Firefox opens PDFs in gedit

5

2

When I click on a PDF link, my Firefox 31 (and older versions as well) always tries to open it with gedit, even though in Nautilus and xdg-open it gets correctly opened in Evince. In Edit->Preferences->Applications the PDF content type action is set to "Save File".

I use GNOME Shell 3.12.2 on Arch Linux 64 Bit.

Konrad Höffner

Posted 2014-08-25T10:21:21.197

Reputation: 348

Answers

6

I've found some pointers to this.

First, check what program the system uses for a PDF file.

Then, there is the horrible mimetypes.rdf file which stores Firefox preferences for opening applications. It is somewhere in your /home/you/.mozilla profile directory.

Then, when something is 'unknown' it will be opened by some kind of guessing algorithm.

To change this, I heard you can do this:

sed 's#.*octet-stream.*#application/octet-stream=xdg-open#' ~/.local/share/applications/mimeapps.list -i

Just tested this myself and found xdg-open will correctly guess the file type.

You can also edit the mimeapps.list by hand. Just set it to 'xdg-open' (no need to append .desktop unless you want it to open via a .desktop link). The application/octet-stream is often used by sites that do not correctly set their mimetype when sending you a file.

Iphigeneia

Posted 2014-08-25T10:21:21.197

Reputation: 76

My .mozilla indeed had a line application/octet-stream=gedit.desktop;, thanks! – Konrad Höffner – 2014-09-23T13:03:39.673

4I just removed "application/octet-stream=org.gnome.gedit.desktop;" from ~/.config/mimeapps.list and everything works OK now. – user31389 – 2015-03-04T21:06:41.750

3~/.config/mimeapps.list was the culprit for me too – Flamefire – 2018-04-19T10:49:13.313

1

To set files applications with standard xdg-open (man xdg-open):

xdg-open /path/to/the_file.EXT

I bet the sed command that Iphigeneia recalled should replace mimeapps.list associations entries with automatic xdg-open? Doesn't change any mimeapps.list lines here; Not an expert with sed to tell why, though.

Some more pointers in https://askubuntu.com/questions/185139/why-does-firefox-try-to-use-gedit-to-open-deb-files

tuk0z

Posted 2014-08-25T10:21:21.197

Reputation: 284