From 1b11c6fcacd51a541aeed911594d4657cff52d3c Mon Sep 17 00:00:00 2001 From: YaoLi Date: Wed, 14 Jun 2023 18:05:50 +0800 Subject: [PATCH 1/2] : compatible with Zotero 6.0 and make preview window focus in Linux // a bug fix that preventing the new sushi preview window from losing window focus <.gitignore> ignore .xpi/.zoteroplugin files for version management add shell script to perform auto-pack for .xpi plugin, compatiale with Zotero 6.0 modify installing section and the part description of non-Windows system 1) installation note for zotero 6.0 2) add path check for quicklook application 3) Gnome Suhi installation guide <.rdf> update zotero6.0 version support and update plugin version numbers to 1.4.3 list Bugs/Low-priority bugs/Ideas // Close #44, #43 --- .gitignore | 4 +++- README.md | 17 +++++++++++++++-- TODO | 11 +++++++++++ chrome/content/.zoteroquicklook.pl.swp | Bin 0 -> 12288 bytes chrome/content/zoteroquicklook.pl | 8 +++++++- install.rdf | 6 +++--- linux_build.sh | 3 +++ update-altwindows.rdf | 6 +++--- update.rdf | 6 +++--- 9 files changed, 48 insertions(+), 13 deletions(-) create mode 100644 TODO create mode 100644 chrome/content/.zoteroquicklook.pl.swp mode change 100644 => 100755 chrome/content/zoteroquicklook.pl create mode 100755 linux_build.sh diff --git a/.gitignore b/.gitignore index 430649f..183b34b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ builds -github.token \ No newline at end of file +github.token +*.xpi +*.zoteroplugin diff --git a/README.md b/README.md index 286c1d9..32df206 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,23 @@ 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 te 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 @@ -24,6 +35,8 @@ 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. diff --git a/TODO b/TODO new file mode 100644 index 0000000..9c3cd10 --- /dev/null +++ b/TODO @@ -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): +- +- diff --git a/chrome/content/.zoteroquicklook.pl.swp b/chrome/content/.zoteroquicklook.pl.swp new file mode 100644 index 0000000000000000000000000000000000000000..33848fdcc8fdab724ff2d6f3582f1fab6b8695df GIT binary patch literal 12288 zcmeI2!EYNy6vn5VaG`)eh#Pu!jMj;~UdI&@vXzR0po%DMAy6Tjs2T6hdbb(xYeWj5wA%0&xTcQhVmaH?y`Ih#C%@Kx65P*E4V4y!V@#XIYt1 z@51`4^jvq9;q@3}KknU%{%Budjc*v6@F-E07N+a4m!1kyCTj9ehBxO9gHw4f(~y^` z%5?CyDn+4QtI}}ij8Z#6m=y38geogVRtE3b?klESqPv^R!(wrLj({U@KLW?tiT-NO z^e#1z(-V)sc|Swf?g%&nj({WJ2si?cfFs}tI0FAe0%d-Ly^FjanB``F9N_uL?DPD6 z_R+mL0*-(q;0QPZj({WJ2si?cfFs}tI0BBqe~&{637M;QAS`U3hK`V9IA`Ve{#Qjml$Ln$Fcf|b_^d+$((^_Wg}I&&R10df9q~<3>G#v<)V1x57!(c^M{y!A34Z z|70O#pO19AWyf9YZ7nYkF>Hx+rIVCYCa>c$&s9;92_wzMr13`zG9zGWT+$j{R%zC5 zQnN#?om9$8c^cs{LI#&+8Cb`EX~8hhSom6G5&1|J#QZ|!nAG%PVo72RMzewAZj}b8WA^9;KGU+z?V?lk|q9H|!$Uq{0^;zRV6R)n(4YHmN z@i8~?uhynFsKuu{m&!>FFGJE&Ad=N?PxyTrMk*6DY}&}@R%>)+7tiGF)|<1{-}Cln z>#b-iC=(*8eNWReA(fk(w}kmhMf|EtqdM-i)I!E&H;N59RFetE8it7ocQhb|vWl>q z7mMZLIH*u)Ei{!0FDc}>FpR`8<#gUhc2YF)i6C>Wm#3N8aC0{vnK?W&qh}%-VFhzO z%|v7)u}CG?<-#9q%;v-GU`%SVGgH~)gsHMfO)16|Vv@>i=|z(YD{UPDNX|8a%m^;h zV!mNINDv2+N2Fq8AX7|fo{F*Vn7FpiQyEcLq1{;HhZCGn=HtoY^)1HMC zMbLPowVM=BuncdFrS%vKjkejI(`H*?vr=A_ND}wTu?GrMt|=|e8tikixng}Bbg_cO zWEAou0t<01H(M9^;+A})!5Wk6REO6(_4?@x7hBjnSvA=jvRD;@hY3!$ZJ~CLx?O55 z88f>;7+F(UYnxnW-!hxoX7)ysYFm}>NMNh>m9f literal 0 HcmV?d00001 diff --git a/chrome/content/zoteroquicklook.pl b/chrome/content/zoteroquicklook.pl old mode 100644 new mode 100755 index cd1c7c5..a700d18 --- a/chrome/content/zoteroquicklook.pl +++ b/chrome/content/zoteroquicklook.pl @@ -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])); } diff --git a/install.rdf b/install.rdf index b40a403..5f52aeb 100644 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ zoteroquicklook@gmail.com 2 ZoteroQuickLook - 1.4.2 + 1.4.3 Mikko Ronkko Brenton M. Wiernik Quick Look Utility for Zotero. @@ -14,14 +14,14 @@ zotero@chnm.gmu.edu 4.0 - 5.* + 6.* juris-m@juris-m.github.io 4.0 - 5.* + 6.* diff --git a/linux_build.sh b/linux_build.sh new file mode 100755 index 0000000..3409b2d --- /dev/null +++ b/linux_build.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +zip -r ./zoteroquicklook.xpi chrome defaults install.rdf chrome.manifest -x .* diff --git a/update-altwindows.rdf b/update-altwindows.rdf index 97834fa..011cd11 100644 --- a/update-altwindows.rdf +++ b/update-altwindows.rdf @@ -5,12 +5,12 @@ - 1.4.2 + 1.4.3 zotero@chnm.gmu.edu 4.0 - 5.* + 6.* https://github.com/mronkko/ZoteroQuickLook/releases/download/1.4.2/zoteroquicklook.zoteroplugin @@ -18,7 +18,7 @@ juris-m@juris-m.github.io 4.0 - 5.* + 6.* https://github.com/mronkko/ZoteroQuickLook/releases/download/1.4.2/zoteroquicklook.zoteroplugin diff --git a/update.rdf b/update.rdf index 97834fa..011cd11 100644 --- a/update.rdf +++ b/update.rdf @@ -5,12 +5,12 @@ - 1.4.2 + 1.4.3 zotero@chnm.gmu.edu 4.0 - 5.* + 6.* https://github.com/mronkko/ZoteroQuickLook/releases/download/1.4.2/zoteroquicklook.zoteroplugin @@ -18,7 +18,7 @@ juris-m@juris-m.github.io 4.0 - 5.* + 6.* https://github.com/mronkko/ZoteroQuickLook/releases/download/1.4.2/zoteroquicklook.zoteroplugin From d915ad9794cea72444c446275308b047db4abaf2 Mon Sep 17 00:00:00 2001 From: YaoLi Date: Sat, 17 Jun 2023 01:05:31 +0800 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 32df206..be85c53 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ 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 te Release section then follow the instructions above. +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. Check path `/usr/bin/qlmanage` and make sure it exists. No additional steps are needed.