I want to open pdf files with program A unless it is stored in Zotero, in which case I want to open it program B.
- Change the OS settings, so the default program for opening pdf files is the shell script shown below.
- Set Zotero preferences to store files in "zotero-data".
Below, I use playonlinux to launch Foxit Reader for my Zotero pdf files because Foxit has nice highlighting and annotation features that I like to use on scientific articles. I use evince for all other pdf files (figures, books, documents, etc.)
#!/bin/bash
# Check if the pdf is in the Zotero folder.
if [[ "$1" == */zotero-data/storage/* ]]
then
# Replace all / with \ (needed for the windows program Foxit Reader)
f="z:${1//\//\\}"
/usr/share/playonlinux/playonlinux --run "Foxit Reader" "$f"
else
evince "$1"
fi
Nifty, thanks!