Reply to topic

folder.jpg pics display in dolphin

User avatar franzwerfel
Registered Member
Posts
3
Karma
0

folder.jpg pics display in dolphin

Sat Dec 08, 2018 10:50 am
Hello,

i am new here and i am very pleased with the look and feel of KDE-Neon.

I use it on a lenovo-thinkpad x220 and installation went quite well. Better and faster than under windows. Amazing!

There is one thing i cannot find in dolphin which i am used to from windows. This is the folder.jpg-function that is so useful when using your laptop as a music-box-device.
With the album-art displayed in the filemanager you can browse very comfortably through your music collection by looking at the covers of the albums. just like browsing through a Lp- or Cd- collection in the real world.

In Dolphin i get a display of several file-pics in every folder but not one that i defined to be the face of the folder. Like the folder.jpg in windows.

Does this possibility exist in Dolphin or any other linux-file manager?

Many thanks in advance for any kind of answer,
franz
User avatar Rog131
Registered Member
Posts
828
Karma
10
KDE preview/thumbnail images

The KDE applications can show a thumbnail for a file/folder if there is a thumb creator plugin installed for the file (or folder) type.

The standard KDE folders thumbnailer is showing four images if there are at least four files to thumbnail.

Image

Same folder with the Keneric:

Image


Optional thumbnailers

The KDE thumbnailers are plugins. You could install another and enable the wanted one from the settings.

The KDE is using freedesktop specifications: http://freedesktop.org/wiki/Specifications/ and there the specification for storing file thumbnails: https://specifications.freedesktop.org/ ... atest.html .

The KDE Frameworks 5 thumbnailer API: https://api.kde.org/frameworks/kio/html ... eator.html

Example with the Keneric plugin
https://store.kde.org/p/1080815/

The Keneric KDE (KF5) thumbnailer is a generic thumbnailer. It is intended to be used when there is no dedicated KDE thumbnailer and there is a fast and simple way to get the thumbnail image (oneliner).


1) Installing the Kenric thumbnailer plugin.

2) Making/adding to the stripPicture script file:
Code: Select all
      inode/directory)
        cp "$fullname"/folder.jpg "$exportPicture"
        cp "$fullname"/Cover.png "$exportPicture"
        cp "$fullname"/Poster.jpg "$exportPicture"
        cp "$fullname"/Front.jpg "$exportPicture"
      exit
      ;;


This will use folder.jpg, Cover.png, Poster.jpg or Front.jpg file as folder thumbnails.

3) Making $HOME/.local/share/kservices5/kenericfolder.desktop:

Code: Select all
[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



4) Disabling the standard KDE folders thumbnailer and enabling the Keneric thumbnailer:

Image


5) Clicking the Preview button:

Image


Another option - Make 'Magick pile of Polaroids' with the KDE service menu

Older example: https://www.kubuntuforums.net/showthrea ... post417941

Image
Image


Preview clip: https://youtu.be/-JEfOa8gAWQ
User avatar franzwerfel
Registered Member
Posts
3
Karma
0
Hello

and thank you veryvery much for answering. It looks like you are giving me EXACT the information i am looking for BUT i do not know how to get it done!

I tried my best without the right result. There are some things i am not sure if i did them right.

How exactly do i install a plug in? I downloaded it, extracted it in the downloadfolder, and copied it (with the manipulated script-files) to the usr/share/kservices5/ folder. I had to install nautilus to get there, because i couldn't start dolphin with super-user-rights.

The second thing i am not sure about is WHERE EXACTLY to put the code-snippets you gave me in your instruction. Maybe i have put them to wrong place in the scripts.

It would be so nice to get this working and i am a bit frustrated that my knowledge is so limited.

Greetings, Franz
User avatar Rog131
Registered Member
Posts
828
Karma
10
Browsing to the https://store.kde.org/p/1080815/

Dowloading the 174485-keneric-0.3.tar.gz

Unpacking the tar.gz

Image

There is /keneric-0.3/readme/readme.html - Hmm maybe it needs a rewrite.

Trinity

To work the Keneric thumbnailer will need:

- Shared library file: keneric.so
- Desktop file for the thumbnailer. In this case: kenricfolder.desktop
- Exeutable script file: stripPicture

keneric.so

The keneric.so will be made by compiling the C++ source.

The compilation is depending (exact package names are distro specific):

cmake
extra-cmake-modules
kio (kio-dev / libkf5kio-dev)

and the shared library will be installed to the distribution specific location.

Example with the Arch Linux:

Operating System: Arch Linux
KDE Plasma Version: 5.14.4
Qt Version: 5.12.0
KDE Frameworks Version: 5.53.0
Kernel Version: 4.19.4-arch1-1-ARCH
OS Type: 64-bit


Installling:

base-devel
cmake
extra-cmake-modules
kio



Compiling example:

Image

Code: Select all
$ cd keneric-0.3

$ mkdir builddir

$ cd builddir && cmake .. -DCMAKE_INSTALL_PREFIX=$(kf5-config --prefix) -DCMAKE_BUILD_TYPE=Release -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
-- The C compiler identification is GNU 8.2.1
-- The CXX compiler identification is GNU 8.2.1
-- Check for working C compiler: /usr/lib/hardening-wrapper/bin/cc
-- Check for working C compiler: /usr/lib/hardening-wrapper/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/lib/hardening-wrapper/bin/c++
-- Check for working CXX compiler: /usr/lib/hardening-wrapper/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - found
-- Performing Test _OFFT_IS_64BIT
-- Performing Test _OFFT_IS_64BIT - Success
-- Performing Test HAVE_DATE_TIME
-- Performing Test HAVE_DATE_TIME - Success
-- Found KF5KIO: /usr/lib64/cmake/KF5KIO/KF5KIOConfig.cmake (found version "5.53.0")
-- Found KF5: success (found version "5.53.0") found components:  KIO
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rog131/Downloads/keneric-0.3/builddir


$ make
Scanning dependencies of target keneric_autogen
[ 25%] Automatic MOC for target keneric
[ 25%] Built target keneric_autogen
Scanning dependencies of target keneric
[ 50%] Building CXX object CMakeFiles/keneric.dir/keneric.cpp.o
[ 75%] Building CXX object CMakeFiles/keneric.dir/keneric_autogen/mocs_compilation.cpp.o
[100%] Linking CXX shared module keneric.so
[100%] Built target keneric


$ sudo make install
[sudo] password for rog131:
[ 25%] Automatic MOC for target keneric
[ 25%] Built target keneric_autogen
[100%] Built target keneric
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/lib/qt/plugins/keneric.so


Now the keneric.so is installed to the /usr/lib/qt/plugins/keneric.so.

Example with the Neon user edition:

Operating System: KDE neon 5.14
KDE Plasma Version: 5.14.4
Qt Version: 5.11.2
KDE Frameworks Version: 5.52.0
Kernel Version: 4.15.0-39-generic
OS Type: 64-bit


Installing:

build-essential
cmake
extra-cmake-modules
libkf5kio-dev


Compiling example:

Code: Select all
$ cd keneric-0.3

$ mkdir builddir

$ cd builddir && cmake .. -DCMAKE_INSTALL_PREFIX=$(kf5-config --prefix) -DCMAKE_BUILD_TYPE=Release -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - found
-- Performing Test _OFFT_IS_64BIT
-- Performing Test _OFFT_IS_64BIT - Success
-- Performing Test HAVE_DATE_TIME
-- Performing Test HAVE_DATE_TIME - Success
-- Found KF5KIO: /usr/lib/x86_64-linux-gnu/cmake/KF5KIO/KF5KIOConfig.cmake (found version "5.52.0")
-- Found KF5: success (found version "5.52.0") found components:  KIO
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rog131/Downloads/keneric-0.3/builddir

$ make
Scanning dependencies of target keneric_autogen
[ 25%] Automatic MOC for target keneric
[ 25%] Built target keneric_autogen
Scanning dependencies of target keneric
[ 50%] Building CXX object CMakeFiles/keneric.dir/keneric.cpp.o
[ 75%] Building CXX object CMakeFiles/keneric.dir/keneric_autogen/mocs_compilation.cpp.o
[100%] Linking CXX shared module keneric.so
[100%] Built target keneric

$ sudo make install
[sudo] password for rog131:
[ 25%] Automatic MOC for target keneric
[ 25%] Built target keneric_autogen
[100%] Built target keneric
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/lib/x86_64-linux-gnu/qt5/plugins/keneric.so


Now the keneric.so is installed to the /usr/lib/x86_64-linux-gnu/qt5/plugins/keneric.so

kenricfolder.desktop

KDE Frameworks 5 services are installed to the

Code: Select all
$ kf5-config --path services
/home/<USER>/.local/share/kservices5/:/usr/share/kservices5/


Making the user kservices5 directory if it doesn't exist:
Code: Select all
$ mkdir -p $HOME/.local/share/kservices5/


Making $HOME/.local/share/kservices5/kenericfolder.desktop:

Code: Select all
[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


Image


stripPicture

The 'stripPicture' could be a simple executable shell script:

Code: Select all
#!/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


The shell scripts are looked from the $PATH
How to set your $PATH variable in Linux: https://opensource.com/article/17/6/set-path-linux

The $PATH can be looked with the konsole:
Code: Select all
$ echo $PATH


I'm using bash (with the Arch Linux) and I have the $HOME/.bash_profile. It has:

export PATH="${PATH}:$HOME/.bin"

So my system is looking executables from:
Code: Select all
$ echo $PATH
/usr/lib/hardening-wrapper/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/rog131/.bin


I can use for the script file the '/home/rog131/.bin/stripPicture'.

Image

The Neon has .profile file:
Code: Select all
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
   . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi


So the script file can be in '$HOME/.local/bin/stripPicture'

Image

The '$HOME/.local/bin' can be made with the command:
Code: Select all
$ mkdir -p $HOME/.local/bin


or with the Dolphin right click 'Create New' context menu:
Image
User avatar franzwerfel
Registered Member
Posts
3
Karma
0
Hello Rog,

Thank you so very much for your effort! With your detailed and exact description and all the examples and screenshots i did it! It works wonderfully and looks better than in the windows explorer.

I like KDE-Neon so much and this was the only feature (important one for me) that could have lured me back to this nonfuncional OS.

It also is an amazing experience to be helped in such a friendly way! Thank you again and i hope you have a pleasent week.

Greetings, Franz
User avatar Rog131
Registered Member
Posts
828
Karma
10
Few notes

True or false
https://api.kde.org/frameworks/kio/html ... eator.html

If the thumbnail creation is cheap (such as text previews), you can set

CacheThumbnail=false
in the desktop file to prevent your thumbnails from being cached on disk.


Image

Preview clip of true or false: https://youtu.be/17uGo_cCZ2A


Oneliners to make folder icon from the folder.jpg

Straight copy

Code: Select all
cp "$fullname"/folder.jpg "$exportPicture"


Result: Image

Modifying the folder icon with the Imagemagick
( https://www.imagemagick.org/script/index.php )

folder.jpg on the top of the folder icon

Code: Select all
convert $HOME/.local/share/icons/folders/breeze_folder.png \( "$fullname"/folder.jpg -thumbnail '180x180' \) -compose Over -gravity center -composite "$exportPicture


Result: Image

$HOME/.local/share/icons/folders/breeze_folder.png is
Image


Polaroid on the top of the folder icon

Code: Select all
convert $HOME/.local/share/icons/folders/breeze_folder.png \( "$fullname"/folder.jpg -thumbnail '180x180' -bordercolor snow -background black -polaroid 0 \) -compose over -gravity center -composite  "$exportPicture"


Result: Image


folder.jpg between the folder icon background and the front

Code: Select all
convert $HOME/.local/share/icons/folders/Back.png \( "$fullname"/folder.jpg -thumbnail '180x180' \) -gravity center -composite $HOME/.local/share/icons/folders/Front.png -gravity center -composite "$exportPicture"


Result: Image

Back, Front and directory icon:
Image


...and the plasma can also use the Keneric:
Image
User avatar Rog131
Registered Member
Posts
828
Karma
10
More notes:

Now and then the Dolphin is using the default folders icons. I think that this is a variant of the Bug 402530 - Folder previews are shown for folders that have previews turned off - https://bugs.kde.org/show_bug.cgi?id=402530 .

 
Reply to topic

Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], claydoh, Google [Bot], Horus, koffeinfriedhof, Yahoo [Bot]