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
:
[Desktop Entry]
Comment=mime type settings file
Exec=kate /home/cip/Applications/defaults.list
Icon=preferences-desktop-filetype-association
Name=Mimetype settings
NoDisplay=false
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=
(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.
xdg-mime default okular.desktop application/pdf
, let me know if it worked. – Ravexina Sep 19 '18 at 08:47