Monday, December 14, 2009

Changing default editor for PDFs in GNOME

In Gnome (Gnome 2.28, Ubuntu 9.10), opening a file does not always yield the same result. Depending on where the file is double-clicked on, a different viewer might be displaying it. Here some idea how to get this right.

I wanted to open PDF files using Acrobat Reader instead of Ubuntu's default reader Evince. For Nautilus (and the Desktop), file associations can be changed using the file's property menu. This then resulted in PDF files to be opened with Acrobat Reader when double-clicked on in Nautilus and with Evince basically everywhere else: Firefox, Eclipse, ...

It turns out that Nautilus allows to specify custom associations, overriding Gnome's MIME-based system. So, to establish Acrobat Reader as the default editor for PDF files, open ~/.local/share/applications/defaults.list (i.e. in your home directory) and add the following entry to the [Default Applications] section.

application/pdf=AdobeReader.desktop

If there is no such file, do create it and paste the following content:

[Default Applications]
application/pdf=AdobeReader.desktop

Done. Double-clicking a PDF in Firefox now starts Acrobat Reader.

For inspiration on other mime types (and the global settings), see the file by the same name in /usr/share/applications.