Categories
Draft

Handle Zotero links on Linux

In this post I want to cover how you can work with Zotero links on Linux.

An example links is: zotero://select/library/items/II3DUXPK

To open them you can type in a terminal: xdg-open zotero://select/library/items/II3DUXPK

If nothing happens you need to register Zotero to be used for opening zotero://... links.

You can do this via this command: xdg-mime default zotero.desktop x-scheme-handler/zotero

This will add an entry in the file ~/.config/mimeapps.list

You can view it via cat ~/.config/mimeapps.list

For this setting to be working you need to have a zotero.desktop file in ~/.local/share/applications

To create this file you can use:

cat > ~/.local/share/applications/zotero.desktop << EOF
[Desktop Entry]
Name=Zotero
Exec=/home/user/apps/zotero/zotero --url %U
Icon=/home/user/apps/zotero/chrome/icons/default/main-window.ico
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
Name[C.UTF-8]=zotero
EOF

You need to replace /home/user/apps/zotero/ with your Zotero folder containing the program.

Now you can check if zotero is registered as default application with: xdg-mime query default x-scheme-handler/zotero

Now you can check again if it is working: xdg-open zotero://select/library/items/II3DUXPK

This will execute this command under the hood: /home/user/apps/zotero/zotero --url zotero://select/library/items/II3DUXPK (see Exec=... line above)

Obtaining Zotero links

To copy the zotero item url you need to install the Zutilo Plugin.

Then go to Tools -> Zutilo Settings -> Shortcuts -> Copy select item links -> CTRL+C