So, what are normal people doing tonight?

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.

YouTube Video

Here’s the script:

customthumbs.shraw
#!/bin/bash

target=$1
filename=`basename $1`
image="${TMPDIR}${filename}.png"
rsrc="${TMPDIR}icn.rsrc"

# Create a thumbnail from the file preview
qlmanage -t -s 512 -o ${TMPDIR} $target

# apply the image to itself as an thumbnail icon
sips -i $image

# Extract the icon resource
DeRez -only icns $image > $rsrc

# Make the target accept a custom icon
SetFile -a C $target

# Apply the icon resource to the target
Rez -append $rsrc -o $target

# clean up
rm $rsrc $image

Pointless in this particular case, but if I can get you to use it, I can feel good about my wasted evening.

  1. Delish and HoudahSpot make a potent combo.