This is a hack to:
* add sort of an "emblem" feature to the folders in KDE4.
* simulate the "folder.jpg" functionnality of Windows XP (i.e. assign as icon to
the directory an image present within itself)

Both functionnalities are available through a "service menu", i.e. you can
right-click a folder, then choose "Actions", then one of the four menu entries
created by the installation of the .desktop file:
* Add emblem
* Add emblem (recursive)
* Apply folder image
* Apply folder image (recursive)

You can also right click on any image within a folder, then choose the action
"Set as folder icon" in order to apply the selected image as the folder icon.

Pre requisites
--------------

This software requires ImageMagick (package imagemagick in Mandriva, or
the equivalent for your distro)

If you want to turn on size optimization of the generated folder icons (see
below) then you will need one of advpng (package advancecomp), pngcrush or
optipng.

Emblem feature
--------------
It allows you to select an icon, and add it to the normal icon folder of the
selected folder. New folder icons are generated and assigned to the directory.

It works through the use of a KDE Service menu (right click on the directory,
then choose "Actions", then "Add emblem"). It can do it recursively.

"folder.jpg" feature (folder image)
-----------------------------------
It allows you to assign to a directory (and its sub-directories if called
recursively) an image which is stored within, as an icon.
Despite its name, any image name will do it.

If the folder image is not square, then applying it as a folder icon would
strech it. In order not to stretch the image, a new image (square, with a
transparent background) will be generated in the directory. The resulting
image will be named after the original image. For example, if the image is
folder.jpg, folder.jcc.png will be generated.
Of course if the image is square it will be used as is.

Note 1: due to a bug in KDE (at least in 4.4.3), you cannot use hidden images as
folder icons (for example .folder.png would be nice, but won't work).

Note 2: if you want to turn on size optimization of the generated folder.jcc.png
then you will need one of advpng (package advancecomp), pngcrush or optipng

Command line
------------
The software comes with emblem.sh, a program that can also be called from the
command line.

Options:
--help show this help text and exit
--nodialog do not fire kdialog in case of an error
--recursive perform the action on the folder <target folder>
and all of the folders contained witin
--local save the generated icon as <target folder>/folder.png
instead of creating it ~/.config/jcc/emblems
(useful to move directories between machines without
losing their icon)
--folderimg use <image file name> as the icon to be set
(e.g. folder.jpg)
if used with --ask, the user will be asked interactively
--defaultfolderimg default image name to be used in the dialog box when
asking the user. Implies --folderimg --ask.
--optimize optimize generated images for non square folder icons
--setasfoldericon allows to set the image given as a parameter as its
containing directory icon
--notify send notifications to the desktop so that passive popups
can be displayed when the job is over (the error
messages are also displayed this way instead of dialogs)
Install
-------
To install, copy the .desktop files to the kde4 service menus directory
(e.g. /usr/share/kde4/services/ServiceMenus/emblem.desktop
or better ~/.kde4/share/kde4/services/)

and copy emblem.sh to your bin directory
(e.g. ~/bin/emblem.sh)
Note: if /home/<user>/bin does not exist, then create it.

emblem.sh needs the "composite" command from ImageMagick. This package must be
installed on your machine.

To configure the parameters, please edit directly emblem.sh.
In particular, you should edit BASE_FOLDER_ICON to point to the default
folder icon you are using.

You can also change the location of emblem.sh, but you'll have to modify
the emblem.desktop file to point to the right place.

Note: the generated folder emblem icons are stored in ~/.config/jcc/emblems/

Last changelog:

8 years ago

0.6 22/11/2010 new functionnality: the generated icons when the directory
image is not square are now optimized (requires advpng
(package advancecomp), pngcrush or optipng).
bug fix: 0.5 introduced a regresion for directories with two
adjacent spaces in their names (folder icon functionality).
bug fix: now always exits with a return code 0 on success
(it was possible to exit with a different return code if qdbus
had problems with ghost dolphins)
new functionnality: --progressbar displays a dialog box with a
progress bar, when using --recursive
new funcitonnality: --notify uses desktop notifications instead
of dialog boxes for error messages, plus notifies the end of
the job.
new functionnality: whenever it applies, make use of the icon
preferences-desktop-icons (notifications, dialog boxes)
new functionnality: --setasfoldericon, also accessible by right
click (through new desktop file emblem2.desktop)

0.5 15/11/2010 bug fix: "folder.jpg" was hardcoded instead of using the user
defined filename (when not using --recursive). Fixed.
new functionality: when "folder.jpg" (or the like) is not square
then generate a square icon, so that it will not be stretched
when applied as a folder's icon

0.4 14/11/2010 bug fix: did not work when the target directory was not an
absolute path. Fixed.
bug fix: did not work when the best folder.png resolution was
less than 3 digits
(e.g. was searching in 064x064 instead of 64x64)
bug fix: now use the correct tmp directory (use ~/tmp if it
exists, else use $TMP, else $TMPDIR, else/tmp)

It won't. First it works only on directories, then it is more a hack than a real emblem support. In fact icons are generated for the folder when you assign it an "emblem".
I don't know/use dropbox, so do not know how the emblems are generated there.

8 years ago

0.6 22/11/2010 new functionnality: the generated icons when the directory
image is not square are now optimized (requires advpng
(package advancecomp), pngcrush or optipng).
bug fix: 0.5 introduced a regresion for directories with two
adjacent spaces in their names (folder icon functionality).
bug fix: now always exits with a return code 0 on success
(it was possible to exit with a different return code if qdbus
had problems with ghost dolphins)
new functionnality: --progressbar displays a dialog box with a
progress bar, when using --recursive
new funcitonnality: --notify uses desktop notifications instead
of dialog boxes for error messages, plus notifies the end of
the job.
new functionnality: whenever it applies, make use of the icon
preferences-desktop-icons (notifications, dialog boxes)
new functionnality: --setasfoldericon, also accessible by right
click (through new desktop file emblem2.desktop)

0.5 15/11/2010 bug fix: "folder.jpg" was hardcoded instead of using the user
defined filename (when not using --recursive). Fixed.
new functionality: when "folder.jpg" (or the like) is not square
then generate a square icon, so that it will not be stretched
when applied as a folder's icon

0.4 14/11/2010 bug fix: did not work when the target directory was not an
absolute path. Fixed.
bug fix: did not work when the best folder.png resolution was
less than 3 digits
(e.g. was searching in 064x064 instead of 64x64)
bug fix: now use the correct tmp directory (use ~/tmp if it
exists, else use $TMP, else $TMPDIR, else/tmp)