In my thunderbird setup (version 60.0 on 64-bit Debian Stretch) PDF attachments are opened in libreoffice showing generally useless gibberish. That is when I double-click. When I right-click, there is no 'open with ...' option, so to fix it I need to find the list of applications for opening PDF files.

Likewise, my favourite light-weight image viewer is qiv, but PNG attachments in thunderbird are opened in gimp. Double- (or right-) clicking a PNG file always gives me an options dialogue with a list of programs to open it, with gimp as the default. However, qiv is not in that list.

So I would like to know

(a) is it possible to configure thunderbird so that other programs can be selected to open certain files (in my case, having the option for PDF files and having a complete list for PNG files)?

(b) is it possible to configure my desktop (Xfce 4.12) so that I can set sensible choices (in my case, not letting libreoffice open PDF files)?


1. Arbitrary file ⇒ MIME type:

The shared-mime-info database is consulted to determine its MIME type, based on file extension and/or known 'magic' headers. I think even Thunderbird goes through this step, discarding whatever MIME type had been declared by the email.

The database consists of "source" XML files, which aren't used directly but instead compiled into "cache" files by update-mime-database.

2. MIME type ⇒ app .desktop file:

The user's mimeapps.list files are searched for the explicitly associated default application, pointing to an app's .desktop file. (It allows any app and isn't limited by the MimeTypes declared in that .desktop file.)

(In CLI, xdg-mime query default <type> and xdg-mime default <app> <type> can be used to manipulate this list conveniently. In Xfce, you probably can do the same in Thunar – any PDF file's "Properties" window will let you select the default app for all PDF files.)

If there isn't an explicit association, then a list of apps is built from the .desktop files (see the following section) as well as "added associations" in mimeapps.list (full algorithm here) and the "most preferred" app is launched.

3. App .desktop file ⇒ executable program:

All "associatable" apps must have a .desktop file (desktop-entry-spec) in one of the standard locations (~/.local/share/applications/, /usr/share/applications).

The .desktop file should declare what MimeTypes it wants to be associated to by default. A reverse lookup cache (MimeType ⇒ .desktop file) is automatically maintained in mimeinfo.cache in the same locations. These associations can be overridden by Section 2 above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.