Reputation: 2779
While trying to install and configure Zotero using a bash script, I'm encountering some difficulties in adding an .xpi
addon using bash. The documentation says:
To install a plugin in Zotero, download its .xpi file to your computer. Then, in Zotero, click “Tools → Add-Ons”, then drag the .xpi for the plugin onto the Add-Ons window that opens.
My closest approach was simulating the "open with" option and chosing "Zotero". However, even when using "open with" manually, Zotero assumes the incoming file is a literature file instead of an addon file. So the implementation:
#!/bin/bash
zotero some.xpi
Analogous to option 1 of this answer, launches Zotero, yet it does not (prompt the user to) install the add-on.
I did not yet find an API or method to load the add-on automatically. Hence I would like to ask: How can I add an arbitrary .xpi
add-on for Zotero from a bash script?
Upvotes: 0
Views: 308
Reputation: 2779
The instructions in the documentation did not work for me, so I found out another method:
One can
install.rdf
file/modules/
directory of the Zotero Standalone Build repository/staging/<your system architecture>/
)/staging/<your system architecture>/defaults/prefs.js
file../zotero
.git clone --recursive https://github.com/zotero/zotero-standalone-build
...
npm run build
git clone [email protected]<your zotero extension>.git
# Switch out build file to add additional plugin
cp -r "src/build.sh" "src/submodules/zotero/zotero-standalone-build/build.sh"
..
npm build
...
staging/Zotero_linux-x86_64/zotero -purgecaches
I created a modified build.sh
file for the zotero-standalone-build
which adds the extensions to the prefs.js
file with:
echo 'pref("extensions.something.unopkgPaths", "{}");' >> "$APPDIR/defaults/preferences/prefs.js"
echo 'pref("extensions.something.version", "");' >> "$APPDIR/defaults/preferences/prefs.js"
echo 'pref("extensions.something.installed", false);' >> "$APPDIR/defaults/preferences/prefs.js"
echo 'pref("extensions.something.skipInstallation", false);' >> "$APPDIR/defaults/preferences/prefs.js"
The build command specifics depend on the addon you want to include.
Upvotes: 1