I’ve been messing around with some more ideas surrounding the future of bookmarking and information gathering. As part of that process, I bought Delish and started messing around with some Spotlight/Finder integration1. I won’t go into all of the kMDItemAwesome of that, but I did work out a trick on the way that might actually be useful.
The thumbnails for Delish cache folders (and what shows up in a Finder Smart Folder) are all… broccoli? I figured it shouldn’t be too hard to make them prettier for searching. The technique should be able to be applied to any application’s files which provide a Quick Look preview.
#!/bin/bashtarget=$1filename=`basename$1`image="${TMPDIR}${filename}.png"rsrc="${TMPDIR}icn.rsrc"# Create a thumbnail from the file previewqlmanage-t-s512-o${TMPDIR}$target# apply the image to itself as an thumbnail iconsips-i$image# Extract the icon resourceDeRez-onlyicns$image>$rsrc# Make the target accept a custom iconSetFile-aC$target# Apply the icon resource to the targetRez-append$rsrc-o$target# clean uprm$rsrc$image