Zotero opens PDF files in GIMP, KRITA, KARBON instead of OKULAR

Zotero is wrongly opening PDF files in applications like GIMP, Krita, Karbon or others, instead of Okular, which is the default.

Environment: Linux, in particular: Debian and Ubuntu
  • Short answer, for the impatient (it may not work!)

    If you lazy, you can try this:
    $ xdg-mime default kde4-okularApplication_pdf.desktop application/pdf
    ... which will add an entry under "[Default Applications]" in your
        ~/.local/share/applications/mimeapps.list
    [Default Applications]
    application/pdf=kde4-okularApplication_pdf.desktop

    Long answer (better chances to work)

    1. From command line, verify if xdg-open opens a .pdf file properly, using the application you expect, in this case: Okular.
    $ xdg-open somefile.pdf
    If it does not work, reinstall xdg-utils and okular
    $ sudo apt-get install --reinstall xdg-utils okular -y
    2. If still does not work, the trouble is probably in the way Firefox is obtaining the application it must launch.

    In Linux systems (at least it is true for Debian and derivatives), mimetypes are stored at these locations
    1. system: /usr/share/applications/mimeinfo.cache
    2. user: ~/.local/share/applications/mimeapps.list
    User defaults take precedence over system defaults.
    In the example below you see that Okular is the first application:
    (newlines and spaces added for clarity)
    $ fgrep application/pdf ~/.local/share/applications/mimeapps.list
    application/pdf=kde4-okularApplication_pdf.desktop;
    kde4-karbon.desktop;
    display.im6.desktop;
    kde4-krita_pdf.desktop;
    So, edit your ~/.local/share/applications/mimeapps.list and make sure that Okular is the first application.

    Also, make sure that the name for the Okular application is correct, in accordance with the way it is defined at system level. This is how you can verify its name at system level:
    $ fgrep application/pdf /usr/share/applications/mimeinfo.cache
    application/pdf=gimp.desktop;
    kde4-karbon.desktop;
    kde4-krita_pdf.desktop;
    kde4-okularApplication_pdf.desktop;
    In other words, we see that the correct name is
        "kde4-okularApplication_pdf.desktop"
    ... in this example. So, this is the name you need to put in your
        ~/.local/share/applications/mimeapps.list
Sign In or Register to comment.