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.
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.
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
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
:(In this example
/home/cip/Applications/defaults.list
is a link to/usr/share/applications/defaults.list
becausekate /usr/share/applications/defaults.list
doesn't work in this case. Butsh -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 withapplication/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.