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

Thumbnails do not show up on Gnome anymore #1612

Closed
ysooqe opened this issue Nov 18, 2019 · 25 comments · Fixed by #2738
Closed

Thumbnails do not show up on Gnome anymore #1612

ysooqe opened this issue Nov 18, 2019 · 25 comments · Fixed by #2738
Labels
bug difficulty::medium papercut User can get around easily... but can be annoying. priority::low
Milestone

Comments

@ysooqe
Copy link

ysooqe commented Nov 18, 2019

Affects versions :

  • OS: Linux
  • Gnome (X11)
  • Version of Xournal++ : 1.0.14 and 1.0.16

Description
Since 1.0.14, Thumbnails for .xopp files do not show up in the file manager (Nautilus) anymore

To Reproduce

  1. Open the file browser and look for a .xopp file.

Expected behavior
The .xopp file has a thumbnail that shows the contents of the first page of the file.

Actual behavior
It uses the generic icon of Xournalpp instead of thumbnails.

@ysooqe ysooqe added the bug label Nov 18, 2019
@LittleHuba
Copy link
Member

Did you install one of the prior versions manually using make install?

@ysooqe
Copy link
Author

ysooqe commented Nov 18, 2019

Did you install one of the prior versions manually using make install?

No, I have not done that.

@LittleHuba
Copy link
Member

Please check out this comment anyway and check if those files exist:
#1442 (comment)

@Rmano
Copy link
Contributor

Rmano commented Nov 18, 2019

I have installed 1.0.16 (from git branch with sudo make install, and to be on the safe side I did:

CMAKE_INSTALL_PREFIX=/usr/local
rm -f ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps/xournalpp.svg
rm -f ${CMAKE_INSTALL_PREFIX}/share/mime/packages/xournalpp.xml
rm -f ${CMAKE_INSTALL_PREFIX}/share/applications/xournalpp.desktop
rm -f ${CMAKE_INSTALL_PREFIX}/share/thumbnailers/xournalpp.thumbnailer
rm -f ${CMAKE_INSTALL_PREFIX}/share/metainfo/xournalpp.appdata.xml

(as root) before installing, and still I have this:
image

@LittleHuba
Copy link
Member

@Rmano you have to run:

./cmake/postinst configure

@Rmano
Copy link
Contributor

Rmano commented Nov 18, 2019

Done; no error. I removed the thumbnail cache (rm -rf ~/.cache/thumbnails) and still I have the same behavior.
I will investigate a bit more...

@ysooqe
Copy link
Author

ysooqe commented Nov 19, 2019

Please check out this comment anyway and check if those files exist:
#1442 (comment)

I checked and all those files exist.

@LittleHuba
Copy link
Member

As mentioned in the comment. Please delete the files.

@ysooqe
Copy link
Author

ysooqe commented Nov 19, 2019

As mentioned in the comment. Please delete the files.

Sorry, that was not very clear from my side:
I do have the files that SHOULD be there. None of the files are named xournalpp but com.github.xournalpp.xournalpp as they should be according to the linked comment.

@Technius
Copy link
Member

Technius commented Nov 28, 2019

Looks like thumbnail generation is failing. Here's a file I found in ~/.cache/thumbnails/fail/gnome-thumbnail-factory/ after saving a dummy file and opening the folder in a file manager (I deleted ~/.cache/thumbnails before):

<89>PNG
^Z
^@^@^@^MIHDR^@^@^@^A^@^@^@^A^H^F^@^@^@^_^Uĉ^@^@^@^Dd<88>^@^@^@^_tEXtThumb::URI^@file:///tmp/foo.xopp<99><C2>L<EA>^@^@^@^WtEXtThumb::MTime^@1574923269<A6>
<A6>^@^@^@ tEXtSoftware^@GNOME::ThumbnailFactoryoDU<E0>^@^@^@^KIDA<99>c`^@^B^@^@^E^@^AbU2<88>^@^@^@^@IEND<AE>B`<82>

Edit: note that xournal-thumbnailer runs correctly when run manually.

@Technius
Copy link
Member

This appears to be a bug in Nautilus.

I cleared the thumbnail cache and opened the containing folder with Nemo; the thumbnail displayed correctly.

@Technius Technius added the Dependency Issue The issue is within a dependency and cannot be solved by us. label Nov 28, 2019
@Rmano
Copy link
Contributor

Rmano commented Nov 28, 2019

This appears to be a bug in Nautilus.

I cleared the thumbnail cache and opened the containing folder with Nemo; the thumbnail displayed correctly.

Hmm, I will check, but I do not think that this is the problem. I have the workaround described in the linked post installed since more than one year, and nevertheless the problem should have been fixed upstream (I'll try to dig out the links later).

Mind you, it could still be a Nautilus bug, but I don't think is this one.

@jason-v-w
Copy link
Contributor

This does not directly address your issue, but I thought I would mention it in case it is related. I found that when I export my Xournal++ file to .pdf, Nautilus does not show the thumbnail (just shows the general .pdf icon), but when I use the print menu and choose to print to a .pdf file, then Nautilus shows the thumbnail of that .pdf properly.

@robinp7720
Copy link
Contributor

robinp7720 commented Oct 4, 2020

I believe I've discovered the source of the issue. Nautilus uses bwrap to isolate thumbnailers, which also means that only the thumbnailer application and the file to thumbnail exist in the view of the thumbnailer. The thumbnail cannot be generated because the thumbnailer cannot find the xournalpp icon to overlay onto the thumbnail. I've got it working here: https://github.com/robinp7720/xournalpp/blob/fixthumbnailer/src/xoj-preview-extractor/xournalpp-thumbnailer.cpp by removing the code to overlay the xournalpp icon.

If the removal of the icon is ok, I'll create a pull request. It would probably be possible to check within the thumbnailer if it's running within a bwrap environment and include the icon if it can. I'm however personally not a fan of the overlayed icon.

@Technius
Copy link
Member

Technius commented Oct 5, 2020

Awesome, thanks for troubleshooting the issue. I dug some more into this issue and found the root cause: the image loading code that I wrote is a hack that uses gtk_init and gdk_pixbuf. Pixbuf dynamically loads its loader libraries, causing the bwrap: execvp /tmp/xournalpp-thumbnailer: No such file or directory errors due to the sandbox.

The thumbnailer uses GTK because I wanted to avoid a librsvg dependency...but GTK already depends on librsvg so we might as well change it to use librsvg only! I'll see if I can fix this tomorrow.

@Technius Technius added difficulty::medium papercut User can get around easily... but can be annoying. priority::low and removed Dependency Issue The issue is within a dependency and cannot be solved by us. labels Nov 13, 2020
@Technius Technius added this to the v1.1.0 milestone Nov 13, 2020
@Febbe
Copy link
Collaborator

Febbe commented Nov 13, 2020

In PR #2252 I removed gtk_init will this either fix this issue or make it worse?

@Technius
Copy link
Member

#2252 is unrelated to this issue, which only affects the thumbnailer.

@Technius
Copy link
Member

Technius commented Feb 3, 2021

Can someone try #2738? The thumbnails should at least show up--not sure if the icon will show up anymore though.

@robinp7720
Copy link
Contributor

robinp7720 commented Feb 3, 2021

Can someone try #2738? The thumbnails should at least show up--not sure if the icon will show up anymore though.

I can confirm that #2738 fixes the issue on nautilus, it even shows the xournallpp icon!

xournalp_thumbnailer_working

However, in some cases it seems that the thumbnail isn't being rendered. This was however an issue before #2738 too with file managers that don't use bwrap. I'll send an offending file if desired.

xournalpp_thumbnailer_notworking

@Technius
Copy link
Member

Technius commented Feb 3, 2021

That's great. I think I'll leave the other issue to be fixed some other time.

@rolandlo
Copy link
Member

Under Ubuntu 20.10 I only got the thumbnailer working after wrapping bwrap as described in this solution

@moorepants
Copy link

I upgraded from Ubuntu 20.04 to 22.04 and am using the xournal++ snap package, now thumbnails display as gzip:
image

@Technius
Copy link
Member

Technius commented Jun 5, 2022

@moorepants Does this problem also occur if you use the xournalpp deb package available in the official Ubuntu 22.04 repository instead of the snap?

@moorepants
Copy link

@moorepants Does this problem also occur if you use the xournalpp deb package available in the official Ubuntu 22.04 repository instead of the snap?

I don't know. I'll have to switch and see. I was using the snap in 20.04 to have the latest version and the thumbnails worked then.

@moorepants
Copy link

The thumbnails work as expected with the deb package included with Ubuntu 22.04.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug difficulty::medium papercut User can get around easily... but can be annoying. priority::low
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants