Keeping my custom Leopard stack overlays in front!

I’ve been using Leopard for a couple of weeks now. I don’t know about you, but I have a hard time telling at a glance which stack is which… A handful of blogs have posted about the Japanese blogger (note: blog is all in Japanese) who hooked us up with really spiffy custom stack overlays. Now the overlays are available in color, and there are a ton more of them.

The latest version of the overlay icons come pre-tweaked, so they’ll work whether you sort by name, by “date modified”, or by “date created”. But my downloads stack is sorted by “date added”, and the it turns out that “date added” is tough to spoof with timestamps.

A couple of blogs have posted AppleScript or Automator solutions, but none of them were quite slick enough for me. so here’s my shot at it:

  1. Download the custom stack overlays, choose some you like, and add them to your stacks. If you have the old overlays already, make sure to grab the new ones for this to work.

  2. Download and unzip my refresh stack overlays script.

  3. Copy it to /Library/Scripts/Folder Action Scripts.

  4. Add the new folder action to any folder you want — I use it on “ToDo” and “Downloads”. (instructions for adding folder actions here).

  5. Whenever a file is added to your folder, the stack overlay will move to the front.

In case you’re interested, here’s the script:

on adding folder items to this_folder after receiving added_items
    tell application "Finder"
        set file_list to name of every file of this_folder
        repeat with this_item in file_list
            if this_item begins with " " and this_item ends with " .app" then
                set icon_name to this_item
                exit repeat
            end if
        end repeat
        do shell script "mv -f " & quoted form of (POSIX path of this_folder & icon_name) & " /tmp"
        do shell script "mv -f " & quoted form of ("/tmp/" & icon_name) & " " & quoted form of (POSIX path of this_folder)
    end tell
end adding folder items to