- Google Chrome
- Mac OS X
Google Chrome and the Downloads stack
27 September 2011
Before you start reading, please note that the thing this letter talks about is outdated and should be replaced by a better solution. You can read about it here.
It's been a year since I cowardly abandoned Safari the Lazy in favor of Chrome the Prompt for my browsing tasks. The former was lethargic, whatever the configuration, and the number of tabs it could show was limited in a fashion that neither I nor the Sainte-Force could stand. However, in spite of its lack of energy, Safari was perfect for downloading, especially because it integrated so nicely with the Downloads stack in the Dock. When you started a download in Safari, a new icon appeared over the Downloads stack, telling roughly how much of the file has been downloaded (see fig. 1). When the download is completed, the brand new downloaded file and the underlying Downloads stack bounce gaily in the Dock, so that I can check its kind or contents at a glance. How nice and informative at the same time it is ! That's exactly what the Sainte-Force wants you to experience today with Google Chrome (and conceivably with other not-so-well-integrated browsers). Continue to read to know more about it or install without further ado !
Unfortunately, I can't say Chrome is as good of a Mac OS X citizen as Safari. When a download starts, Chrome places a disgusting
crdownload file with a blank icon (fig. 2) on the Downloads stack. Moreover, when a download finishes, a strange bug prevents the Downloads stack from updating and it is stuck with the blank file icon for some time. The idea of a nice and informative view offered by the Downloads stack vanishes from your expectations and meet the promise of a better world in the kingdom of hopeless dreams.
What seemed at first sight to be an aesthete's caprice turns out to be a slight discomfort, which is unacceptable for you and me ! Short story long, the Safari way is rad because it doesn't spread interactional and informative aspects of the same file all over the screen : everything you need is that icon on top of the Downloads stacks. The icon carries information about the file, whether it is an actual or a yet-to-be-loaded one. Because it is a file, it can be moved anywhere (included in the Trash). The problem with Chrome is twofold :
- There is no information about the state of the download. The dreaded blank file icon shows nothing. A progress bar, or at least something to say "Not complete yet, come back later" would be nice. Notice that this information is already present on the Chrome dock icon, but not directly on the file on top of the Downloads stack.
- There is no information about the state of the file after it is downloaded : the dreaded blank file icon strikes again ! To see a preview or at least an icon, you have to open the stack. Tedious. Moreover, when you close the stack, its icon is not updated !
Simply put, it is of vital importance to get this stuff working in Chrome because it would be nice to have it.
With the help of the Sainte-Force, I came up with an acceptable solution. You'll be able to enjoy it either with tools already on your Mac, like Automator, or with the help of Hazel, a useful but expensive esquire. The next section explains the whys and may not be extremely useful for you if you don't like alchemy talking, don't want to discover some Mac OS X underpinnings and prefer action with heavy guns and screaming wheels. If so, please skip to the Installation section.
When Chrome downloads a file called
Sainte-Force.png on the Internet, it creates a temporary file called
Sainte-Force.png.crdownload in your Downloads folder. Because the extension tells the type of the file, and because such a type is unknown to Mac OS X's tearful eyes, the dreaded blank file icon is shown. Once done, the file is renamed
Sainte-Force.png with the proper extension, so Mac OS X can see what it is for real and ornates the file with the most sumptous preview or icon.
You can see it by yourself by downloading a quite large file with Chrome and carefully watching the file in the Downloads folder (in the Finder, not in the Dock). You'll see the dreaded blank file icon with the
.crdownload extension, and then... POOF! The real file ! Now may I ask you a question : how do you automatically change this blank icon, for every
.crdownload file, into a more expressive one ?
The answer is to associate
.crdownload files with an application, which will provide a custom icon. Although you can hack into
Google Chrome.app, bear in mind that Chrome updates itself very often and your fix won't last long. I'm not sure you'll be eager to patch Chrome once a week. Hopefully, there's a better way to do it. Let's create an application ! Automator allowed me to create a very simple application that only opens Chrome. With the help of docerator I created nice document icons (fig. 3), which go into the
./Content/Resources folder of the application bundle. I needed to tweak the
./Content/Info.plist a bit to associate one of these icons to the desired files. Figure 4 shows what I added to the
CFBundleDocumentTypes array. Don't edit the application back in Automator after this because it rebuilds the application from scratch, so all your modifications would be gone and you would become insane pretty quickly.
So, now there's something better ! Let's download a file and see what says our favorite stack in the Dock (fig. 5). No need to wait an hour or two : the dreaded icon is gone, the new icon is pretty, but it stays like this forever. Not very classy, indeed.
The last part of our mission is to get the Downloads stack out of bed as soon as a new download is finished. How to stimulate a stack, mister Sainte-Force ? Easy as figure 6 (but take care, your eyes may shed blood). I am confident in your ability, dear reader, to find a less grotesque solution.
It would be problematic if every new file added in the Downloads folder stimulated the Dock like this. Imagine the wealth of unnecessary file operations when unarchiving a zip containing every Midnite song in the Downloads folder (I hope it is an entirely fictional scenario) ! That's A LOT ! We should instead check for specific files, those that were downloaded somewhere. Hopefully, nearly any browser in Mac OS X leaves a special attribute in the filesystem for downloaded files. The attribute we are looking for is called
Basically, the ultimate solution is to check, when a file is added to the Downloads folder, if it is a downloaded file, and to stimulate the Download stack if necessary. I succeeded in doing this both with a Folder Action (no, don't run away, to tell the truth it's easy with Automator) and with a trial of Hazel.
Download the following disk image and follow carefully what's in the Read me first file. Don't be intimidated by its length or apparent complexity, it is very simple and should take not more than 5 minutes !
- Google Chrome Downloads stack fix (Mac OS X 10.5+)
You may notice there's a delay between the actual completion of the download and the icon update in the stack. Maybe you know a better workaround ?
Looking forward to hearing from you,