Zotero 7 Beta: How to link to an entry or a file from another app?
Is it currently possible to quickly copy the link to an entry or a file in Zotero 7 Beta without using plugins?
My aim is to create a link to an entry in Zotero in another text editor, like Obsidian or Zim Wiki.
My aim is to create a link to an entry in Zotero in another text editor, like Obsidian or Zim Wiki.
As you said, I get two links now:
zotero://select/library/items/RRVBGNDY
zotero://open-pdf/library/items/JAI9BBFJ?page=1&annotation=TSU6I2A3
But when clicking on them, Zim Wiki shows that the links can't be opened, although Zim is assigned properly to open such links.
I'm using Ubuntu 23.04 and done the following to assign Zim to open "zotero://" links:
update-mime-database ~/.local/share/mime
update-desktop-database ~/.local/share/applications
and
gio mime x-scheme-handler/zotero
which shows:
Default application for »x-scheme-handler/zotero«: zotero.desktop
Registered applications:
zotero.desktop
Recommended applications:
zotero.desktop
So according to the following instructions, everything is assigned properly, see https://github.com/shivams/zim-zotero-plugin#handling-zotero-links
But my zotero.desktop looks differently from the recommendations in the link above, since I've followed the official instructions: https://www.zotero.org/support/installation#how_do_i_install_zotero
This is the content of my zotero.desktop (which is a symlink in /home/sojusnik/.local/share/applications/zotero.desktop):
[Desktop Entry]
Name=Zotero
Exec=bash -c "$(dirname $(realpath $(echo %k | sed -e 's/^file:\/\///')))/zotero -url %U"
Icon=/home/sojusnik/Apps/Zotero/chrome/icons/default/default256.png
Type=Application
Terminal=false
Categories=Office;
MimeType=text/plain;x-scheme-handler/zotero;application/x-research-info-systems;text/x-research-info-systems;text/ris;application/x-endnote-refer;application/x-inst-for-Scientific-info;application/mods+xml;application/rdf+xml;application/x-bibtex;text/x-bibtex;application/marc;application/vnd.citationstyles.style+xml
X-GNOME-SingleWindow=true
For additional information, when launching Zim with "zim -D" in the terminal for debugging purposes, the relevant output when clicking on a "zotero://" link shows:
…
DEBUG: Activate link: zotero://select/library/items/RRVBGNDY
DEBUG: open_url(zotero://select/library/items/RRVBGNDY)
DEBUG: Got type "x-scheme-handler/zotero" for "zotero://select/library/items/RRVBGNDY"
DEBUG: Loading config from: /home/sojusnik/.local/share/applications/zotero.desktop
INFO: Spawning: ('bash', '-c', "$(dirname $(realpath $(echo /home/sojusnik/.local/share/applications/zotero.desktop | sed -e 's/^file:////')))/zotero -url %U", 'zotero://select/library/items/RRVBGNDY') (cwd: /home/sojusnik)
DEBUG: Process started with PID: 68907
sed: -e Ausdruck #1, Zeichen 11: Unbekannte Option für »s«
realpath: fehlender Operand
„realpath --help“ liefert weitere Informationen.
dirname: fehlender Operand
„dirname --help“ liefert weitere Informationen.
zotero://select/library/items/RRVBGNDY: Zeile 1: /zotero: Datei oder Verzeichnis nicht gefunden
DEBUG: Running ErrorDialog
DEBUG: zotero://select/library/items/RRVBGNDY kann nicht geöffnet werden
NoneType: None
ERROR: zotero://select/library/items/RRVBGNDY kann nicht geöffnet werden
DEBUG: BackgroundCheck finished
So I guess something is wrong with my zotero.desktop?
...
Exec=/home/myusername/myzoteroprogramdir/zotero -url %U
...
MimeType=x-scheme-handler/zotero
...
So (at least for me) no need here to fiddle with the bash extra step.
Exec=/home/myusername/myzoteroprogramdir/zotero -url %U
it finally works, thanks!
Will create another thread about the proper content of zotero.desktop, see https://forums.zotero.org/discussion/107692/zotero-7-beta-linking-doesnt-work-on-linux-with-recommended-zotero-desktop
Just one more question.
It seems that Zotero must run in the background in order to open the proper entry/file, if it's not running and you click on a link, then it just opens Zotero, without selecting the linked entry/file.
Can you confirm that?
Is this by design or a bug?
After doing the steps described in this post (https://forums.zotero.org/discussion/comment/443441/#Comment_443441), now, after restoring the Zotero 7 Beta installation with all folders and tweaks so that linking should work, clicking on a Zotero link does nothing at all when Zotero isn't running. Only after manually starting Zotero, clicking on the link will select the linked entry. So before the steps mentioned in the link, at least Zotero was starting when clicking on the link, but now not any more.
What could be the reason?
But now the link always opens not the specified page, but the following, f.i. when clicking on zotero://open-pdf/library/items/GTW2HVPE?page=36, then page 37 is opened, although 36 is linked.