mronkko / ZoteroQuickLook

Implements QuickLook in Zotero
748 stars 82 forks source link

gnome-sushi support #23

Closed kupiqu closed 2 years ago

kupiqu commented 4 years ago

gloobus-preview has been unmaintained for years in favor of gnome-sushi. I can use gnome-sushi to preview documents (even without using nautilus) using dbus from the terminal like this:

dbus-send --print-reply --dest=org.gnome.NautilusPreviewer /org/gnome/NautilusPreviewer org.gnome.NautilusPreviewer.ShowFile string:"URI_path" int32:0 boolean:false

So for, e.g., dolphin in kde I created a .desktop file with the following content:

[Desktop Entry]
Categories=Tools;
Comment=Sushi preview
Exec=dbus-send --print-reply --dest=org.gnome.NautilusPreviewer /org/gnome/NautilusPreviewer org.gnome.NautilusPreviewer.ShowFile string:"file://%f" int32:0 boolean:false
Icon=sushi.svg
MimeType=all/all;
Name=Sushi
NoDisplay=false
Path[$e]=
StartupNotify=true
Terminal=0
TerminalOptions=
Type=Application
Version=1.0
X-KDE-SubstituteUID=false
X-KDE-Username=

This works nicely in dolphin but if I use the path to the .desktop file in Zotero, ZoteroQuickLook does not work, i.e., the sushi preview is not shown and nothing happens.

bwiernik commented 4 years ago

You should be able to make this work by specifying a customviewcommand. Otherwise, a pull request replacing gloobus-preview with gnome-sushi would be welcome.

kupiqu commented 4 years ago

You should be able to make this work by specifying a customviewcommand. Otherwise, a pull request replacing gloobus-preview with gnome-sushi would be welcome.

Yes, I should, but I couldn't find the way to make it work. I set the correct path to it, yet gnome-sushi is not triggered.

I cannot submit a pull request because it doesn't work for me. It would be great if other people gives it a try and try to reproduce the issue...

bwiernik commented 4 years ago

I would suggest forking the repository for the plugin and editing the main code to replace the references to gloobus with ones to gnome-sushi and see if you are able to make it work in testing on your end. I don’t have a Linux system, so I don’t have a way to diagnose or test it on my end.

kupiqu commented 4 years ago

I would suggest forking the repository for the plugin and editing the main code to replace the references to gloobus with ones to gnome-sushi and see if you are able to make it work in testing on your end. I don’t have a Linux system, so I don’t have a way to diagnose or test it on my end.

It doesn't make sense to fork it unless I get it working, which I could achieve so far. But sure, if I get it working, I will submit a pull request.

jwittke commented 4 years ago

On Ubuntu 19.04 with Zotero 5.0.82 I solved the issue by creating a small bash script

#!/bin/bash
# run GNOME sushi

PDF_FILE=$(/usr/bin/realpath "$*")
echo "$PDF_FILE" > test.txt

dbus-send --print-reply --dest=org.gnome.NautilusPreviewer /org/gnome/NautilusPreviewer org.gnome.NautilusPreviewer.    ShowFile string:"file://$PDF_FILE" int32:0 boolean:false

make this executable and then make a symbolic link to /usr/bin/gloobus-preview.

fhchl commented 4 years ago

jwittkes works like a charm, but one has to remove the space in front of ShowFile:

dbus-send --print-reply --dest=org.gnome.NautilusPreviewer /org/gnome/NautilusPreviewer org.gnome.NautilusPreviewer.ShowFile string:"file://$PDF_FILE" int32:0 boolean:false
bwiernik commented 4 years ago

If someone wants to make a pull request, I would take it.

kupiqu commented 4 years ago

It worked, but only after creating the symbolic link to /usr/bin/gloobus-preview. For whatever reason this doesn't work:

You should be able to make this work by specifying a customviewcommand.

LamFTS commented 3 years ago

On Ubuntu 19.04 with Zotero 5.0.82 I solved the issue by creating a small bash script

#!/bin/bash
# run GNOME sushi

PDF_FILE=$(/usr/bin/realpath "$*")
echo "$PDF_FILE" > test.txt

dbus-send --print-reply --dest=org.gnome.NautilusPreviewer /org/gnome/NautilusPreviewer org.gnome.NautilusPreviewer.    ShowFile string:"file://$PDF_FILE" int32:0 boolean:false

make this executable and then make a symbolic link to /usr/bin/gloobus-preview.

hi, i am using zotero 5.0.89 on ubuntu18.04, I copy your script, make it executable and make a symbolic link to /usr/bin/gloobus-preview, but zotero warning with /usr/bin/gloobus-preview missing, so i specify the absolute path of the script on customviewcommad, then space can triger the sushi-preview windows, but nothing show up. would you please tell me what is wrong with my step? and what's more, i don't quite understand the purpose of this line "echo "$PDF_FILE" > test.txt" @jwittke

fengmao31 commented 3 years ago

i cannot find where is the sushi link

bwiernik commented 3 years ago

I don’t have a Linux machine to test on. If someone submits a pull request changing that Linux default to GNOME Sushi, I will merge it.

nro-bot commented 3 years ago

EDIT: Does not seem to work (space on pdf in zotero does nothing; right click "quick look" on pdf does nothing). Will debug later --> UPDATE 2 Jun 2021: I gave up on below process and instead I install the zotero 6.0 beta, it works well. See https://www.zotero.org/support/pdf_reader_preview

===

Notes on fix based on above comments.

rui@chaiX1YG2:~/Documents$ $ sudo apt install gnome-sushi
rui@chaiX1YG2:~/Documents$ $ cat ~/Documents/gloobus-fix.sh 
#!/bin/bash
# run GNOME sushi

PDF_FILE=$(/usr/bin/realpath "$*")
echo "$PDF_FILE" > test.txt

dbus-send --print-reply --dest=org.gnome.NautilusPreviewer /org/gnome/NautilusPreviewer org.gnome.NautilusPreviewer.ShowFile string:"URI_path" int32:0 boolean:false

rui@chaiX1YG2:~/Documents$ $ sudo ln -s ~/Documents/gloobus-fix.sh /usr/bin/gloobus-preview

rui@chaiX1YG2:~/Documents$ $ /usr/bin/gloobus-preview 
/usr/bin/realpath: '': No such file or directory
method return time=1621850743.293420 sender=:1.1436 -> destination=:1.1478 serial=30 reply_serial=2

if you see

./gloobus-fix.sh: line 7: 320142 Aborted                 (core dumped) dbus-send --print-reply --dest=org.gnome.NautilusPreviewer /org/gnome/NautilusPreviewer org.gnome.NautilusPreviewer. ShowFile string:"file://$PDF_FILE" int32:0 boolean:false

Then probably you have extra spaces :)

If you see

rui@chaiX1YG2:~/Documents$ $ /usr/bin/gloobus-preview
bash: /usr/bin/gloobus-preview: No such file or directory

Double-check the names you used for symlinking