Skip to content
Menu
Ryan and Debi & Toren
  • highpoints
  • Privacy Policy
  • R
  • tech
  • Where I’ve Been
Ryan and Debi & Toren

Linux – Fixing PDFs opening in GIMP in Firefox/Zotero (instead of Evince or Okular)

Posted on September 29, 2014

I’m not exactly sure why, but with the latest Firefox updates, every time I download a PDF using Firefox or try to open one using Zotero integrated with Firefox, the PDF opens in GIMP.  This didn’t used to happen, but it’s really annoying.  It’s doubly annoying since you can’t solve it inside Firefox.

It would make sense to be able to change this in one of two ways.  First, by simply setting your system-wide preference for what program opens PDFs, that should do it, but mine was already set to Okular (you can change the default for most programs by right-clicking a PDF file, selecting Properties, then File Type Options and setting the program you want to be the default).

The second logical solution would be to change the default applications in Firefox, but that doesn’t do anything.  It turns out, the solution is to edit a different file, changing the order of default applications for opening PDFs. Here’s what you need to do:

Open a terminal and gain root privilege to edit the following file: /usr/share/applications/mimeinfo.cache.  Here’s the command I use in Kubuntu:

sudo kate /usr/share/applications/mimeinfo.cache

NOTE: As of Kubuntu 18.04, you now have to use the following command to edit protected files with Kate:

SUDO_EDITOR=kate sudoedit /usr/share/applications/mimeinfo.cache

Once you have edit permissions for that file, search for this line:

application/pdf=gimp.desktop;okularApplication_pdf.desktop;

The order of the applications after the “=” indicates the order in which they will be used to load PDFs. Right now, GIMP will be used first. All you need to do to fix this is to change the order so Okular is first, like this:

application/pdf=kde4-okularApplication_pdf.desktop;gimp.desktop;

Once you change it, save your changes and then restart Firefox.  Your PDFs should now load in Okular.

UPDATE:

For those who have used this workaround in the past, they may have realized that this fix is temporary. The next time you update your software or change something, gimp, again, gets set as the default for PDF files. In order to make this a permanent fix, there is another option. You can override the mimeinfo.cache list by creating a file in the /usr/share/applications directory called “mimeapps.list” that overrides mimeinfo.cache. Here’s what you would add to the file if you want Okular to be your default PDF reader:

[Default Applications]
application/pdf=okularApplication_pdf.desktop

Now, whenever there is an update to your system, the mimeapps.list file will override the mimeinfo.cache file and you shouldn’t have to keep changing this. (Source)

 7,193 total views,  3 views today

21 thoughts on “Linux – Fixing PDFs opening in GIMP in Firefox/Zotero (instead of Evince or Okular)”

  1. kde user says:
    April 12, 2015 at 1:22 am

    thanks. That was really annoying!

    Reply
  2. Harri says:
    April 18, 2015 at 10:42 am

    Thanks! I also had gwenview opening directories, so the same reordering for inode/directory was in order:
    inode/directory=kde4-dolphin.desktop;kde4-gwenview.desktop;

    Reply
  3. Antonio Ferraro says:
    July 18, 2015 at 11:09 am

    Thanks! Great post.

    Reply
  4. Carlos says:
    August 17, 2015 at 9:23 am

    Thanks for your explanations. I have followed your instructions and they work great. For a while. From time to time (I haven’t figured out what triggers the event) my manual changes are reverted and PDFs are opened again with GIMP, files are opened with Gwenview instead of Dolphin… and so on.

    Isn’t there any way to prevent this from happening again?

    Reply
    1. ryan says:
      August 18, 2015 at 7:27 am

      Hi Carlos,

      I don’t know precisely what causes this. I think (could be wrong) that it happens with every update of Firefox, updated to other software, and possibly every time you change the program associated with a file type (or MIME type). That is when mimeinfo.cache gets updated, and that’s probably what does it. The real question is what setting in what program accessing the /usr/share/applications/ directory reverts the changes. I honestly don’t know. Luckily, this only gets reverted for me every few months.

      Reply
  5. Alberto says:
    January 22, 2016 at 4:03 am

    Thanks!

    Reply
  6. Malvineous says:
    January 30, 2016 at 9:01 pm

    Instead of editing files by hand, I have found that you can use the xdg-open command to select the application to use from the command line. This has the added advantage that it updates files specific to you as a user, so after a system update the setting won’t revert back again. See https://wiki.archlinux.org/index.php/Xdg-open for details.

    Reply
  7. proof-reading.services writing scholarship says:
    December 9, 2016 at 7:21 am

    Well, I have no problems with their browser, but I have some with the other thing. I guess I should reinstall my Ubuntu.

    Reply
  8. David says:
    January 6, 2017 at 3:05 pm

    Thanks, man! 🙂

    Reply
  9. Thibault says:
    May 16, 2017 at 7:55 am

    This works but there’s a huge but: gimp comes back as the default viewer quite frequently, does this only happen to me?

    Reply
    1. ryan says:
      May 16, 2017 at 8:14 am

      Thibault, it does happen to others. What version of Linux are you using? I recently updated to Linux Mint 18 KDE on all of my computers and this isn’t happening anymore.

      Reply
      1. Thibault says:
        December 5, 2017 at 6:12 am

        I’m using Debian Stretch with KDE. What I’ve done now is I’ve removed application/pdf from the MimeType in /usr/share/applications/gimp.desktop

        This should stop Gimp from adding itself to the mimeinfo cache for PDFs.

        Reply
  10. custom writing paper says:
    September 22, 2017 at 3:18 am

    One my friend told me that LInux is the best search angine. It seems to me that it is true.

    Reply
  11. Mr. E says:
    September 13, 2018 at 10:11 am

    2018-september and this tip is still working and useful in Manjaro KDE.
    Thank you!

    Reply
  12. Steffen says:
    October 31, 2018 at 3:12 pm

    Thanks for this post! 🙂

    However, you should _never_ use or advice to use “sudo kate” or similar due to unfixable security issues.

    If you need to edit files for which higher privileges are required, go for sudoedit. 😉

    Reply
    1. ryan says:
      November 1, 2018 at 3:17 pm

      Post has been updated to reflect that. Thanks for the comment!

      Reply
  13. order thesis revision services and the best writer says:
    April 9, 2019 at 6:24 am

    This is a very interesting and informative article for me since I am constantly working with files of this format and I need to know as much as possible about it.

    Reply
  14. Pingback: dual boot - Install Ubuntu on Lenovo Yoga 730-15IWL with a i5-8265U CPU alongside Windows - Bizidev.com
  15. Rafael says:
    March 20, 2020 at 11:10 pm

    Thank you, tried the mimeapps.list fix and it did the trick!!

    Reply
  16. Sys says:
    June 4, 2020 at 8:55 pm

    > Thank you, tried the mimeapps.list fix and it did the trick!!
    There, too!

    Reply
  17. Pingback: Install Ubuntu on Lenovo Yoga 730-15IWL with a i5-8265U CPU alongside Windows

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • advice
  • country highpoints
  • funny stuff
  • general news
  • hiking
  • memories
  • movie reviews
  • opinions
  • other
  • politics
  • R
  • religion
  • sociology
  • state highpoints
  • stories
  • technology
  • Toren
  • travel
  • website feedback
©2023 Ryan and Debi & Toren | WordPress Theme by Superbthemes.com