How to change default applications: Doc Viewer to Okular
I'm on latest 21.10 (Wayland default, Gnome 40.4.0) and have the default "Document Viewer" (Evince?) for viewing pdfs. I'm having trouble with it hanging when I have too many open. So I'd like to change the default pdf viewer to be Okular without having to go to the file manager and choose it in Preferences each time. After lots of searching around, I've got nowhere. How do you actually do this in U21.10 in the year 2021?
Solution 1:
I can't speak for GNOME, but I'm on Xubuntu with Nemo File Manager also called "Nautilus" (sudo apt install nemo
) and I can easily change it by going to the PDF -> Right Click -> Properties
Then go to "Open With", select the App you want and click "Set as default"
Hopefully this is not too different on GNOME
Cheers
Update:
This setting is global, i.e. When you click "Set as default" it sets it globally for all pdfs for all apps in the system implementing the XDG protocol
As for your follow up questions:
On Xubuntu I can set Nemo in "Preferred Applications" (app name is exo-preferred-applications). On GNOME it is apparently here
As for where is Nemo setting the PDF stuff, it's in the MIME settings for XDG. There are several GUI MIME editors, my distro already comes with xfce4-mime-settings
.
Just google "MIME GUI editor linux". This answer has more info about the details of MIME associations.
Basically if the MIME is set up correctly, then the command xdg-open myfile.pdf
should open with what you set (e.g. Okular)