I'm unable to figure out why Firefox is opening PDF files in LibreOffice. This happens when I open the file in the downloads view (the little down area on the toolbar).

When I first click on a PDF it correctly asks me to save the file -- I've set this option in the preferences. But when I click to open the downloaded file it uses LibreOffice.

If I use Dolphin (KDE file browser) and click on the file it correctly opens the file with Okular.

I don't know where Firefox is getting the PDF -> LibreOffice association for downloaded files.

I've attempted the solutions listedn in Firefox application associations not working in the 'Downloads' window and they are not working for me.

  • Run xdg-mime default okular.desktop application/pdf, let me know if it worked.
    – Ravexina
    Sep 19, 2018 at 8:47
  • @Ravexina No, it did not appear to change it. I restarted Firefox to be certain. Sep 19, 2018 at 10:06
  • @edA-qamort-ora-y did you find a solution meanwhile?
    – bonanza
    Jul 30, 2019 at 6:56
  • 1
    @bonanza I did not find the reason. I ended up deleting my Firefox profile, cache, and data directories. With a fresh profile it works. Jul 30, 2019 at 10:29

2 Answers 2


I managed to fix it with kde system settings. Go to File Associations, there find pdf Application preference order. It has Okular in the top, so I first put it down, so that LibreOffice in the top, and clicked Apply. Then I placed the Okular back to the top and applied again. Now firefox picked it up.

  • 1
    This was what I originally tried, note that I say Dolphi is opening the file correctly: the system settings are correct. It was uncertain where Firefox was getting it's association from. Jun 23, 2021 at 16:03
  • @edA-qamort-ora-y - what you describe is a bug, where Firefox is not following the defaults because some apps make changes to /usr/share/applications/mimeinfo.cache no matter the system settings.
    – cipricus
    Jun 14, 2022 at 19:29
  • So, as said by the OP this is not a solution.
    – cipricus
    Jun 14, 2022 at 19:31

Some recently installed applications set themselves as first option for a certain file-type in /usr/share/applications/defaults.list.

(In my experience Google Chrome starts opening pdf files through Firefox downloads list even if my default viewer is Okular and Firefox setting for pdf is to "use system default application". On some systems it was some other application -- e.g. Audacious -- that was trying to act as file manager when in Firefox downloads list I was trying to open the download location folder.)

This is an old recurrent Linux problem, I have seen it in all systems for more then 10 years now. Firefox seems to ignore the system's file association

enter image description here

For me the most simple way to have a solution ready for it is to quickly open that file and look for the first applications for a certain file type, and edit that line.

To open it quickly, create a link to /usr/share/applications/defaults.list and put it on the desktop, and/or add a menu entry to open that link in a text editor, which in Kubuntu creates a file like ~/.local/share/applications/Mimetype settings.desktop:

[Desktop Entry]
Comment=mime type settings file
Exec=kate /home/cip/Applications/defaults.list
Name=Mimetype settings

(In this example /home/cip/Applications/defaults.list is a link to /usr/share/applications/defaults.list because kate /usr/share/applications/defaults.list doesn't work in this case. But sh -c "kate /usr/share/applications/defaults.list" works too.)

For example, after opening /usr/share/applications/defaults.list and searching for pdf, we'll find a line starting with application/pdf=. Move or delete the applications you don't want so that the one you want is set first. For Okular in Kubuntu 22.04: application/pdf=okularApplication_pdf.desktop;.

NOTE: in recent Plasma/Kubuntu, Kate file editor can open a system file and ask for password only when saving the file. On other systems a password may be needed before opening a file in order for it to be saved.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .