How to use image a thumbnail of folder
Make custom thumbnailer for dolphoin file manager.
How to use image a thumbnail of folder
This post is specifically for dolphin file manager in linux. So my goal was to achieve following:
- have a image inside some folders with name
folder.jpg - and display it as thumbnail of the folder
Setting up kenric
For this I used keneric.
- First install
keneric. This will create a shared library filekeneric.soin/usr/lib/x86_64-linux-gnu/qt5/plugins - Now create a desktop file
kenericfolder.desktopin one of the location given by commandkf5-config --path services, which is~/.local/share/kservices5or/usr/share/kseervices5for me
Content of kenericfolder.desktop
[Desktop Entry]
Type=Service
Name=Folder (Keneric)
Name[x-test]=xxFolder (Keneric)xx
X-KDE-ServiceTypes=ThumbCreator
MimeType=inode/directory;
X-KDE-Library=keneric
CacheThumbnail=true
- Now create a script
stripPicturein one of the locations in your$PATHvariable.
Contents of stripPicture
#!/bin/sh
# Usage: stripPicture fullname mime exportPicture
fullname="$1"
mime="$2"
exportPicture="$3"
# thumbnail options by mime type
case "$mime" in
inode/directory)
cp "$fullname"/folder.jpg "$exportPicture"
cp "$fullname"/Cover.png "$exportPicture"
cp "$fullname"/Poster.jpg "$exportPicture"
cp "$fullname"/Front.jpg "$exportPicture"
exit
;;
*)
# case trap
exit
esac
Configuring dolphin
- Now open dolphin -> open
Configure Dolphin...window. - Now in
Generalcategory, in thePreviewstab disable theFolderpreview and enableFolders only one image (Keneric)option.
References
This post is licensed under
CC BY 4.0
by the author.