Can't open .md files in a specific app (Okular)

Hello, I run Kubuntu, and prefer Okular to view Markdown files. In KDE (dolphin) when I double-click on a file with .md extension, it properly comes up in Okular. Yay!

But in Zotero, if I click on a .md file that I have attached to an item -- whether that attachment is a "stored copy of" or a "link to" -- it comes up in ReText, a different application.

I have gone into the Zotero advanced config editor and set the
extensions.zotero.launcher.fileHandler.text/markdown option to value "/bin/okular", but it still opens in ReText. I have even tried creating a custom script ("open-with-okular.sh") which launches okular, made the script executable, and used that as the value of the extensions.zotero.launcher.fileHandler.text/markdown option, all to no avail.

How can I get Zotero to respect my application wishes here?
  • Thanks! This doesn't seem relevant to me, though, as I can open PDFs just fine (in the application I want, Okular) I just can't open Markdown files (.md) in the application I want (Okular).
  • Oh, sorry, it just mentions PDFs because that's the file type people are almost always opening. The point is just that Zotero launches files via the OS. It doesn't know anything about specific programs. So any configuration is outside of Zotero.
  • I believe you, but empirically it definitely doesn't *seem* to work that way. As I described above, my OS always opens .md files with Okular, and Zotero always opens .md files with ReText. I can demonstrate that fact consistently and with tears. How to make them be the same (i.e., both ReText) is my current life struggle.
  • Right, but as that page says,
    file handling on Linux can be affected by many settings
    so you'll want to find the different places this is set in the OS
    ~/.local/share/applications/defaults.list
    would be the first place to look, but depending on the distro, there may be others.
  • Thanks for your help. The contents of that file are:

    [Default Applications]
    application/pdf=kde4-okularApplication_pdf.desktop

    which seems to jive with my OS opening PDFs in Okular, as I desire. Check. What's the next place to look for why Zotero might be opening them in ReText instead?
  • right, but that's for PDFs. The problem in your case are markdown files though. Try specifying an application for text/markdown
  • Oh, duh! Sorry, you're right. Okay, I just now made my .local/share/applications/defaults.list file have these contents:

    [Default Applications]
    application/pdf=kde4-okularApplication_pdf.desktop
    text/markdown=kde4-okularApplication_pdf.desktop

    Is that correct? Hopefully not, because after logging out and back in, and restarting Zotero, it still views .md files in ReText...
Sign In or Register to comment.