Custom thumbnail generation fails












0














I am trying to install a custom thumbnailer for nautilus on Debian testing (Buster) for quite some time now and I can not find an explanation why it doesn't work. Here is a minimal example of what I've been doing:



My first step was to create a file "plaintext.thumbnailer" in the ~/.local/share/thumbnailers/ folder:



[Thumbnailer Entry]
TryExec=$HOME/thumbnailer
Exec=$HOME/thumbnailer %i %o %s
MimeType=text/plain;


The thumbnailer is executable and located in my home folder.
Afterwards I deleted all cached thumbnails with rm -r ~/.cache/thumbnails and killed nautilus with killall nautilus.



However, when I restart Nautilus and open a folder that contains plain text files, I can see that Nautilus tries to generate thumbnails, but fails. Afterwards, the folder ~/.cache/thumbnails/fail/gnome-thumbnail-factory contains exactly as many items as nautilus tried to generate thumbnails for.



The thumbnailer itself is never executed, although Nautilus does find the thumbnailer entry "plaintext.thumbnailer". (If it's deleted, Nautilus doesn't try to generate thumbnails for text/plain anymore, i.e. it does not create any files in ~/.cache/thumbnails/fail/)



For the sake of completeness I'll also provide the source code of the thumbnailer:



#include <string>

#include <cstdlib>

using namespace std;

int main ( int argc, char **argv ) {
string cmd ( "cp test.png " );
cmd += argv[2];

system ( cmd.c_str ( ) );

return 0;
}


Update: I compiled test-desktop-thumbnail.c from the gnome-desktop git repository https://github.com/GNOME/gnome-desktop and used the executable to test thumbnail generation for plain text files, which worked perfectly fine. So I'm guessing there is something wrong with Nautilus.



Update #2: After digging into the nautilus source code I spotted that the call to gnome_desktop_thumbnail_factory_generate_thumbnail ( ... ) in nautilus-thumbnails.c fails for plain text files, although it is called with the very same arguments as in test-desktop-thumbnail.c. As a workaround I replaced it with a system call invoking the compiled test-desktop-thumbnail.c, which is ugly, but does the job.



But I still have no explanation for the behavior of the function gnome_desktop_thumbnail_factory_generate_thumbnail ( ... ), so it would be great if someone could shed some light on this.










share|improve this question
























  • Your scenario works for me without patching nautilus (3.26.3, Ubuntu 18.04) if I use an existing RGBA png. It doesn't work with an 8-bit grayscale png though. Maybe nautilus additionally expects a certain image format in the thumbnail?
    – Stefan Friesel
    May 18 '18 at 9:01
















0














I am trying to install a custom thumbnailer for nautilus on Debian testing (Buster) for quite some time now and I can not find an explanation why it doesn't work. Here is a minimal example of what I've been doing:



My first step was to create a file "plaintext.thumbnailer" in the ~/.local/share/thumbnailers/ folder:



[Thumbnailer Entry]
TryExec=$HOME/thumbnailer
Exec=$HOME/thumbnailer %i %o %s
MimeType=text/plain;


The thumbnailer is executable and located in my home folder.
Afterwards I deleted all cached thumbnails with rm -r ~/.cache/thumbnails and killed nautilus with killall nautilus.



However, when I restart Nautilus and open a folder that contains plain text files, I can see that Nautilus tries to generate thumbnails, but fails. Afterwards, the folder ~/.cache/thumbnails/fail/gnome-thumbnail-factory contains exactly as many items as nautilus tried to generate thumbnails for.



The thumbnailer itself is never executed, although Nautilus does find the thumbnailer entry "plaintext.thumbnailer". (If it's deleted, Nautilus doesn't try to generate thumbnails for text/plain anymore, i.e. it does not create any files in ~/.cache/thumbnails/fail/)



For the sake of completeness I'll also provide the source code of the thumbnailer:



#include <string>

#include <cstdlib>

using namespace std;

int main ( int argc, char **argv ) {
string cmd ( "cp test.png " );
cmd += argv[2];

system ( cmd.c_str ( ) );

return 0;
}


Update: I compiled test-desktop-thumbnail.c from the gnome-desktop git repository https://github.com/GNOME/gnome-desktop and used the executable to test thumbnail generation for plain text files, which worked perfectly fine. So I'm guessing there is something wrong with Nautilus.



Update #2: After digging into the nautilus source code I spotted that the call to gnome_desktop_thumbnail_factory_generate_thumbnail ( ... ) in nautilus-thumbnails.c fails for plain text files, although it is called with the very same arguments as in test-desktop-thumbnail.c. As a workaround I replaced it with a system call invoking the compiled test-desktop-thumbnail.c, which is ugly, but does the job.



But I still have no explanation for the behavior of the function gnome_desktop_thumbnail_factory_generate_thumbnail ( ... ), so it would be great if someone could shed some light on this.










share|improve this question
























  • Your scenario works for me without patching nautilus (3.26.3, Ubuntu 18.04) if I use an existing RGBA png. It doesn't work with an 8-bit grayscale png though. Maybe nautilus additionally expects a certain image format in the thumbnail?
    – Stefan Friesel
    May 18 '18 at 9:01














0












0








0







I am trying to install a custom thumbnailer for nautilus on Debian testing (Buster) for quite some time now and I can not find an explanation why it doesn't work. Here is a minimal example of what I've been doing:



My first step was to create a file "plaintext.thumbnailer" in the ~/.local/share/thumbnailers/ folder:



[Thumbnailer Entry]
TryExec=$HOME/thumbnailer
Exec=$HOME/thumbnailer %i %o %s
MimeType=text/plain;


The thumbnailer is executable and located in my home folder.
Afterwards I deleted all cached thumbnails with rm -r ~/.cache/thumbnails and killed nautilus with killall nautilus.



However, when I restart Nautilus and open a folder that contains plain text files, I can see that Nautilus tries to generate thumbnails, but fails. Afterwards, the folder ~/.cache/thumbnails/fail/gnome-thumbnail-factory contains exactly as many items as nautilus tried to generate thumbnails for.



The thumbnailer itself is never executed, although Nautilus does find the thumbnailer entry "plaintext.thumbnailer". (If it's deleted, Nautilus doesn't try to generate thumbnails for text/plain anymore, i.e. it does not create any files in ~/.cache/thumbnails/fail/)



For the sake of completeness I'll also provide the source code of the thumbnailer:



#include <string>

#include <cstdlib>

using namespace std;

int main ( int argc, char **argv ) {
string cmd ( "cp test.png " );
cmd += argv[2];

system ( cmd.c_str ( ) );

return 0;
}


Update: I compiled test-desktop-thumbnail.c from the gnome-desktop git repository https://github.com/GNOME/gnome-desktop and used the executable to test thumbnail generation for plain text files, which worked perfectly fine. So I'm guessing there is something wrong with Nautilus.



Update #2: After digging into the nautilus source code I spotted that the call to gnome_desktop_thumbnail_factory_generate_thumbnail ( ... ) in nautilus-thumbnails.c fails for plain text files, although it is called with the very same arguments as in test-desktop-thumbnail.c. As a workaround I replaced it with a system call invoking the compiled test-desktop-thumbnail.c, which is ugly, but does the job.



But I still have no explanation for the behavior of the function gnome_desktop_thumbnail_factory_generate_thumbnail ( ... ), so it would be great if someone could shed some light on this.










share|improve this question















I am trying to install a custom thumbnailer for nautilus on Debian testing (Buster) for quite some time now and I can not find an explanation why it doesn't work. Here is a minimal example of what I've been doing:



My first step was to create a file "plaintext.thumbnailer" in the ~/.local/share/thumbnailers/ folder:



[Thumbnailer Entry]
TryExec=$HOME/thumbnailer
Exec=$HOME/thumbnailer %i %o %s
MimeType=text/plain;


The thumbnailer is executable and located in my home folder.
Afterwards I deleted all cached thumbnails with rm -r ~/.cache/thumbnails and killed nautilus with killall nautilus.



However, when I restart Nautilus and open a folder that contains plain text files, I can see that Nautilus tries to generate thumbnails, but fails. Afterwards, the folder ~/.cache/thumbnails/fail/gnome-thumbnail-factory contains exactly as many items as nautilus tried to generate thumbnails for.



The thumbnailer itself is never executed, although Nautilus does find the thumbnailer entry "plaintext.thumbnailer". (If it's deleted, Nautilus doesn't try to generate thumbnails for text/plain anymore, i.e. it does not create any files in ~/.cache/thumbnails/fail/)



For the sake of completeness I'll also provide the source code of the thumbnailer:



#include <string>

#include <cstdlib>

using namespace std;

int main ( int argc, char **argv ) {
string cmd ( "cp test.png " );
cmd += argv[2];

system ( cmd.c_str ( ) );

return 0;
}


Update: I compiled test-desktop-thumbnail.c from the gnome-desktop git repository https://github.com/GNOME/gnome-desktop and used the executable to test thumbnail generation for plain text files, which worked perfectly fine. So I'm guessing there is something wrong with Nautilus.



Update #2: After digging into the nautilus source code I spotted that the call to gnome_desktop_thumbnail_factory_generate_thumbnail ( ... ) in nautilus-thumbnails.c fails for plain text files, although it is called with the very same arguments as in test-desktop-thumbnail.c. As a workaround I replaced it with a system call invoking the compiled test-desktop-thumbnail.c, which is ugly, but does the job.



But I still have no explanation for the behavior of the function gnome_desktop_thumbnail_factory_generate_thumbnail ( ... ), so it would be great if someone could shed some light on this.







nautilus thumbnails






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 16 '18 at 23:09

























asked Dec 12 '17 at 11:18







user265482



















  • Your scenario works for me without patching nautilus (3.26.3, Ubuntu 18.04) if I use an existing RGBA png. It doesn't work with an 8-bit grayscale png though. Maybe nautilus additionally expects a certain image format in the thumbnail?
    – Stefan Friesel
    May 18 '18 at 9:01


















  • Your scenario works for me without patching nautilus (3.26.3, Ubuntu 18.04) if I use an existing RGBA png. It doesn't work with an 8-bit grayscale png though. Maybe nautilus additionally expects a certain image format in the thumbnail?
    – Stefan Friesel
    May 18 '18 at 9:01
















Your scenario works for me without patching nautilus (3.26.3, Ubuntu 18.04) if I use an existing RGBA png. It doesn't work with an 8-bit grayscale png though. Maybe nautilus additionally expects a certain image format in the thumbnail?
– Stefan Friesel
May 18 '18 at 9:01




Your scenario works for me without patching nautilus (3.26.3, Ubuntu 18.04) if I use an existing RGBA png. It doesn't work with an 8-bit grayscale png though. Maybe nautilus additionally expects a certain image format in the thumbnail?
– Stefan Friesel
May 18 '18 at 9:01















active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f410395%2fcustom-thumbnail-generation-fails%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f410395%2fcustom-thumbnail-generation-fails%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Morgemoulin

Scott Moir

Souastre