Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<fix> <user layer>: compatible with Zotero 6.0 and make preview windowwfocus in Linux #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
builds
github.token
github.token
*.xpi
*.zoteroplugin
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,32 @@ This plugin is not currently being actively maintained. It may not work with cur

To install ZoteroQuickLook, download the latest version of `zoteroquicklook.zoteroplugin` from the Releases section of this GitHub repo. In **Zotero** (not in Firefox), open Tools -> Add-ons. Then drag the `zoteroquicklook.zoteroplugin` file onto the Zotero Add-ons window.

Note for __Zotero 6.0__: Replace `zoteroquicklook.zoteroplugin` above, download `zoteroquicklook.xpi` from the Release section then follow the instructions above.

## Installing on Mac
On Mac, ZoteroQuickLook uses macOS's native QuickLook functionality. No additional steps are needed.
On Mac, ZoteroQuickLook uses macOS's native QuickLook functionality. Check path `/usr/bin/qlmanage` and make sure it exists. No additional steps are needed.

## Installing on Linux

On Linux, you must install [Gloobus-Preview](https://launchpad.net/gloobus-preview), a QuickLook-like preview software. On Ubuntu you can do this by running the following commands in terminal:
On Linux, considering that __Gloobus-Preview__ is unmaintained now, it is recommanded to install __Gnome Sushi__ as the QuickLook preview software first. Run the command below to install it in terminal:

```
sudo apt install gnome-sushi # Debian User
run sudo dnf install sushi # Fedora User
```

After the installation is complete, check path `/usr/bin/sushi` and make sure it exists.

If you want to install [Gloobus-Preview](https://launchpad.net/gloobus-preview), a QuickLook-like preview software. On Ubuntu you can do this by running the following commands in terminal:

```
sudo add-apt-repository ppa:gloobus-dev/gloobus-preview
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install gloobus-preview
```
After the installation is complete, check path `/usr/bin/gloobus-preview` and make sure it exists.


For other distributions and versions the installation might be different.

Expand Down
11 changes: 11 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Bugs:
- Missing special character escapes, file names with special sysmbos like $m^{2}$.pdf cant preview
-

Low-priority bugs:
- Unable to preview with in 10 seconds of Zotero just starting
- Sushi sometimes jump to Nautilus file preview window when Zotero select nothing and type to preview

Ideas (to be validated):
-
-
Binary file added chrome/content/.zoteroquicklook.pl.swp
Binary file not shown.
8 changes: 7 additions & 1 deletion chrome/content/zoteroquicklook.pl
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@
if (-e '/usr/bin/qlmanage') { exec('/usr/bin/qlmanage','-p',@files); }
elsif (-e '/usr/bin/sushi') {
# we pass an entire string, instead of a list of args, to `system` because dbus-send needs to run in an actual shell
$cmd = 'dbus-send --print-reply --dest=org.gnome.NautilusPreviewer /org/gnome/NautilusPreviewer org.gnome.NautilusPreviewer.ShowFile string:"file://%s" int32:0 boolean:false';
# kill last process to prevent the new preview window from losing window focus
# grep command checks include 'Previewer' processes that causes a new process with a name containing 'Preview' and 'grep' to be spawned
# so we need grep with option -v to avoid kill itself
$awk_tmp = q{awk '{print $2}'};
$kill_pid = "while [ ` pgrep -c -f org.gnome.NautilusPreviewer` -ge 2 ] ; do kill -15 ` ps aux | grep org.gnome.NautilusPreviewer | grep -v grep | $awk_tmp ` ; sleep 1.0e-2 ;done ;";
$dbus_preview = 'dbus-send --print-reply --dest=org.gnome.NautilusPreviewer /org/gnome/NautilusPreviewer org.gnome.NautilusPreviewer.ShowFile string:"file://%s" int32:0 boolean:false';
$cmd = join(" ", $kill_pid, $dbus_preview);
# sushi only support viewing single file
system sprintf($cmd,File::Spec->rel2abs($files[0]));
}
Expand Down
6 changes: 3 additions & 3 deletions install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<em:id>[email protected]</em:id>
<em:type>2</em:type> <!-- type=extension -->
<em:name>ZoteroQuickLook</em:name>
<em:version>1.4.2</em:version>
<em:version>1.4.3</em:version>
<em:creator>Mikko Ronkko</em:creator>
<em:contributor>Brenton M. Wiernik</em:contributor>
<em:description>Quick Look Utility for Zotero.</em:description>
Expand All @@ -14,14 +14,14 @@
<Description>
<em:id>[email protected]</em:id>
<em:minVersion>4.0</em:minVersion>
<em:maxVersion>5.*</em:maxVersion>
<em:maxVersion>6.*</em:maxVersion>
</Description>
</em:targetApplication>
<em:targetApplication>
<Description>
<em:id>[email protected]</em:id>
<em:minVersion>4.0</em:minVersion>
<em:maxVersion>5.*</em:maxVersion>
<em:maxVersion>6.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
Expand Down
3 changes: 3 additions & 0 deletions linux_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

zip -r ./zoteroquicklook.xpi chrome defaults install.rdf chrome.manifest -x .*
6 changes: 3 additions & 3 deletions update-altwindows.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
<rdf:Seq>
<rdf:li>
<rdf:Description>
<em:version>1.4.2</em:version>
<em:version>1.4.3</em:version>
<em:targetApplication>
<rdf:Description>
<em:id>[email protected]</em:id>
<em:minVersion>4.0</em:minVersion>
<em:maxVersion>5.*</em:maxVersion>
<em:maxVersion>6.*</em:maxVersion>
<em:updateLink>https://github.com/mronkko/ZoteroQuickLook/releases/download/1.4.2/zoteroquicklook.zoteroplugin</em:updateLink>
</rdf:Description>
</em:targetApplication>
<em:targetApplication>
<rdf:Description>
<em:id>[email protected]</em:id>
<em:minVersion>4.0</em:minVersion>
<em:maxVersion>5.*</em:maxVersion>
<em:maxVersion>6.*</em:maxVersion>
<em:updateLink>https://github.com/mronkko/ZoteroQuickLook/releases/download/1.4.2/zoteroquicklook.zoteroplugin</em:updateLink>
</rdf:Description>
</em:targetApplication>
Expand Down
6 changes: 3 additions & 3 deletions update.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
<rdf:Seq>
<rdf:li>
<rdf:Description>
<em:version>1.4.2</em:version>
<em:version>1.4.3</em:version>
<em:targetApplication>
<rdf:Description>
<em:id>[email protected]</em:id>
<em:minVersion>4.0</em:minVersion>
<em:maxVersion>5.*</em:maxVersion>
<em:maxVersion>6.*</em:maxVersion>
<em:updateLink>https://github.com/mronkko/ZoteroQuickLook/releases/download/1.4.2/zoteroquicklook.zoteroplugin</em:updateLink>
</rdf:Description>
</em:targetApplication>
<em:targetApplication>
<rdf:Description>
<em:id>[email protected]</em:id>
<em:minVersion>4.0</em:minVersion>
<em:maxVersion>5.*</em:maxVersion>
<em:maxVersion>6.*</em:maxVersion>
<em:updateLink>https://github.com/mronkko/ZoteroQuickLook/releases/download/1.4.2/zoteroquicklook.zoteroplugin</em:updateLink>
</rdf:Description>
</em:targetApplication>
Expand Down