How do you change the default document viewer to Okular?

31,555

Solution 1

According to here, Right click the file of the format you want, select properties:

enter image description here

Go to the open with tab, select the program you want to be the default for that type of file, then press the button Set as Default:

enter image description here

Solution 2

Well, none of the other answers worked on 14.04, Okular simply doesn't show up in the list. But this worked perfectly:

mimeopen -d myfile.pdf

It will give you a list of applications that can open the file, and will also update the default application for you.

$ mimeopen -d myfile.pdf
Please choose a default application for files of type application/pdf

1) Print Preview  (evince-previewer)
2) Xournal  (xournal)
3) MuPDF  (mupdf)
4) Adobe Reader 9  (AdobeReader)
5) GIMP Image Editor  (gimp)
6) Document Viewer  (evince)
7) Other...

use application

Selecting one of these will set it as the default for application/pdf file types. You can easily set any executable to be the default by using the Other... option:

use application #7
use command: okular
Opening "myfile.pdf" with usr (application/pdf)

Aside: If okular doesn't work, you might want to try entering the full path (usr/bin/okular). You can find out where Okular is located by running which okular.

Solution 3

In Ubuntu 14.04, the file you need to edit is :~/.local/share/applications/mimeapps.list

The name of okular may varies. Someone may also find that there is no "Set as default" button.

So follow these steps:

Step 1: Right click on any pdf file => Open with => find Okular

The name of okular applications now should be specified in mimeapps.list. Now move to step 2.

Step 2: gedit ~/.local/share/applications/mimeapps.list

Step 3: Find okular in [Added association] and copy to [Default application] section.
In my case, it is 'application/pdf=kde4-okularApplication_pdf.desktop;'

And you are done.

Solution 4

First open a terminal and use this command:

gedit ~/.local/share/applications/defaults.list

After opening it, Under the [Default Applications] section add a line like this

application/pdf=okular.desktop;

Now save the file and exit gedit.

Solution 5

In short, if I remember correctly :

  • Right click on a PDF,
  • Properties,
  • Open with,
  • Select an app,
  • Set as default.
Share:
31,555

Related videos on Youtube

LibraryGeekAdam
Author by

LibraryGeekAdam

Updated on September 18, 2022

Comments

  • LibraryGeekAdam
    LibraryGeekAdam almost 2 years

    I have just started using Okular and I love it. It has a lot of functionality that I need when I am in pdfs and it already opens up epubs automatically. How to I get it to open pdfs by default instead of "Document Viewer?"

    I appreciate the help!

  • nanofarad
    nanofarad over 11 years
    I'd add a note to make a backup first.
  • harmputman
    harmputman almost 10 years
    This only works when opening the file from the file manager, not when opening it from another program like Calibre.
  • harmputman
    harmputman almost 10 years
    Perfect answer!
  • jmiserez
    jmiserez almost 10 years
    @systemovich I think you can also just put okular instead of the full path, that should solve the problem with mimeopen thinking the application is called usr.
  • jmiserez
    jmiserez almost 10 years
    I've updated my answer to use okular instead of /usr/bin/okular. This should fix some naming issues in menus where it would otherwise say usr instead of okular.
  • XavierStuvw
    XavierStuvw almost 7 years
    In my case the answer askubuntu.com/a/204826/446253 worked with 14.04
  • XavierStuvw
    XavierStuvw almost 7 years
    Worked with 14.04 LTS
  • Zach Boyd
    Zach Boyd almost 7 years
    Worked with 17.04.
  • Autodidact
    Autodidact almost 6 years
    Works even if myfile.pdf is not a real file!