Open Zotero program as link (zotero://select/...) inside Joplin

Hi there,
I've a question similar to the one a person had for Obsidian forum.obsidian.md/t/problem-opening-zotero-links/11613/11

So I say it in nearly his words:

I am also using Linux (Ubuntu 20.04) and I have a problem. Links to Zotero in format [1] (zotero: //select/items/1_QZBJXD8N) cannot be opened from Joplin (2.6.10). Nothing happens after clicking on it. From a text editor (LibreOffice writer) or a browser, or in terminal (xdg-open) the link works.

I was wondering if Joplin can open other program links at all, but I found out that [less(1)](man:///usr/share/man/man1/less.1.gz) works all right for me.

Could you help me what I need to configure?

PS: all steps from instruction I have done - install translator and chose it in settings

Hi,

here on archlinux, I can open zotero link from joplin but if I'm not mistaken I had been having some problems with that in the past. For example, Joplin can open web link and it call a web browser when this working correctly and it uses configuration external to it. Have you checked if you can open zotero link in a web browser or in libreoffice for example. You may also look at this message: Problem opening Zotero links - #10 by argentum - Resolved help - Obsidian Forum
which suggest to check the output of:

  • xdg-mime query default x-scheme-handler/zotero and
  • xdg-settings get default-url-scheme-handler zotero

Here I get zotero.desktop in both cases.

Hi manouchk,
thanks for your help.
I get the same outputs as you say. In both cases zotero.desktop.
When I open the link in a web browser or in libreoffice everything works fine.
Today I tried again, and I got an error-message after clicking on the link in Joplin.
But it doesn't help me any further.

Ubuntu had an internal Error:
/usr/libexec/xdg-desktop-protal-gtk
...

Seem like Joplin calls xdg differently than firefox or libreoffice...

Any other ideas?

P.S.:

Can you explain this in more detail please?

That is my zotero.desktop:

[Desktop Entry]
Name=Zotero
Exec=bash -c "$(dirname $(realpath $(echo %k | sed -e 's/^file:\/\///')))/zotero -url %U"
Icon=/home/david/opt/Zotero-5.0.96.3_linux-x86_64/Zotero_linux-x86_64/chrome/icons/default/default256.png
Type=Application
Terminal=false
Categories=Office;
MimeType=text/plain;
MimeType=x-scheme-handler/zotero;

It was created via the zotero-script: set_launcher_icon.
Then I did an ln -s ~/opt/Zotero-5.0.96.3_linux-x86_64/Zotero_linux-x86_64/zotero.desktop ~/.local/share/applications/

Where did you get / what generated the Exec= line there? It looks very unusual.

You'd expect it to be something closer to simply Exec=zotero -url %U.

Thanks for your hint.
I think the zotero-script: set_launcher_icon created this line.
But let me try if it works when I change it.

I'd recommend running desktop-file-validate on it, when I've tried it with the example above, it gives the following:

zotero.desktop: error: value "bash -c "$(dirname $(realpath $(echo %k | sed -e 's/^file:\/\///')))/zotero -url %U"" for key "Exec" in group "Desktop Entry" contains a non-escaped character '$' in a quote, but it should be escaped with two backslashes ("\\$")
zotero.desktop: error: value "bash -c "$(dirname $(realpath $(echo %k | sed -e 's/^file:\/\///')))/zotero -url %U"" for key "Exec" in group "Desktop Entry" contains a non-escaped character '$' in a quote, but it should be escaped with two backslashes ("\\$")
zotero.desktop: error: value "bash -c "$(dirname $(realpath $(echo %k | sed -e 's/^file:\/\///')))/zotero -url %U"" for key "Exec" in group "Desktop Entry" contains a non-escaped character '$' in a quote, but it should be escaped with two backslashes ("\\$")
zotero.desktop: error: file contains multiple keys named "MimeType" in group "Desktop Entry"

The last one means that you can simply do MimeType=x-scheme-handler/zotero;text/plain as a single value.

It's opinions on Exec= is harder to understand without knowing really what set-launcher-icon considered proper, but certainly, this is a strange line.

With desktop-file-validate I got exactly the same output.

If I change to Exec=zotero -url %U it doesn't work.
Firefox can't also open the link now. Before that, Firefox could.

Well, it would only be zotero -url %U if it's in your $PATH variable, which you'd be able to confirm with whereis zotero. If it doesn't give an answer, it probably isn't.

To remedy that you'd either

  1. Modify the $PATH variable
  2. symlink the binary to somewhere already in $PATH (e.g, /usr/bin)
  3. (and probably the best option here), use a full path in Exec=, probably something similar to
    Exec=/home/david/opt/Zotero-5.0.96.3_linux-x86_64/Zotero_linux-x86_64/bin/zotero --url %U
    (but I can't see your files obviously, so it might be slightly different).

Ok, I did the last thing
Exec=/home/david/opt/Zotero-5.0.96.3_linux-x86_64/Zotero_linux-x86_64/zotero -url %U
Now Firefox works again.
But Joplin does still nothing when clicking.

So I've been trying to experiment with it, and I'm pretty confident what's happening here is a result of you using the snap version of Joplin; officially it's unsupported. You could run snap list to see if that's the case.

The snap uses a different backend for opening links than the normal release, and this is causing issues. I'm trying to work out exactly what issues, because I'm noticing some unusual behaviour differences (E.G, when Zotero is installed from the community packaged Deb file, it actually does work fine, weirdly...). It'd take a couple of hours to sus it out, if it's even fixable.

In the interests of getting you up and running as quickly as possible, I'd suggest transfering your Joplin data over to the AppImage version. There's some Linux installation instructions here.

You can go on the help menu and click "open file directory" to get the folder where all your snap stored notes are. Copy this over into ~/.config/joplin-desktop, and the AppImage version would import everything just fine. At that point I'd then just run sudo snap remove joplin-desktop so there's only the one version installed.

Everything works fine on the AppImage release in my testing.

To sum up, it is possible to open zotero-links in the terminal, or in firefox, but it doesn't work in Joplin.
Most program links doesn't work in Joplin:
[zotero](zotero://) or [firefox](firefox://) or nearly all other programs doesn't work.
But [manual](man://) or [msteams](msteams://) works.
There must be a reason why some programs open and some not...?

It would be a workaround if I could make a Joplin link that opens Firefox and then automatically pastes the Zotero link, cause from inside Firefox it works.
But the problem is here, that I can't open Firefox from inside Joplin as mentioned above.

I just can open Firefox if I only use a http://www. link, but then I can't paste the zotero://... link.

Any other smart ideas? :slight_smile:

Thanks a log for your great help.
It sounds quite right, what you are saying.
Indeed, I use the snap version of Joplin.
I'll try your suggestion tomorrow.

I tried it exactly as you said, and now it works great.
Thank you so much for your help.

1 Like

Hello, I just came across your post, I don't know if there is an app similar to autohotkey in linux, you can check this thread,

check this autohotkey script, you can edit it and add zotero or any other uri scheme

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.