Quick Trick: Bouncing the Downloads Stack

Matt Patenaude

It's another one of those unanswered questions: how do you bounce the "Downloads" stack?

When Apple first demoed Leopard, Steve Jobs made a point to mention that whenever you downloaded a new file from Safari or Mail or iChat, it would be placed into your Downloads folder, and the Downloads stack would bounce to notify you of the new arrival. "Excellent!" we thought. Then we realized that we couldn't make it bounce — no, that is a power reserved only for Apple. It was assumed that just adding a file would bounce the Downloads stack, but that's not the case, and it makes sense, because Safari at the least adds temporary files to Downloads while the file is in the process of downloading. Plus, what happens if you just want to drag your own file in there?

A little snooping through the Camino source code, however, which is slated to receive Downloads stack bouncing functionality in 2.0, reveals the answer.

The Code

As it turns out, bouncing the Downloads stack is a one-line affair, and it uses Distributed Notifications. Essentially, all you need to do is notify the operating system that a file has finished downloading. If that file happens to be in the Downloads stack, it will bounce it for you.

[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"com.apple.DownloadFileFinished" object:pathToFile];

Just replace pathToFile with the actual path to your downloaded file, and that line of code will cause the Downloads stack to bounce. Just make sure you note that this will only work if pathToFile is indeed contained within the current user's Downloads folder. That's all there is to it!