setWeblocThumb
This is a small command-line program for OS X that assigns custom icons to Web Internet Location (.webloc) files, displaying a thumbnail of the web page that they point to.
This is what the icons look like:
Usage
Here's the usage info of this program (run it without any arguments to see this):
usage: setWeblocThumb [options] <path>
Sets custom icons for .webloc files that display
a thumbnail of the web page that they point to.
<path> may point to a .webloc file or a directory
that contains .webloc files.
[options:]
-u check for updates (and optionally auto-update self)
-f sets icons also for files that already have a
custom icon (they are ignored by default).
-ni doesn't load the site's favicon image and add it to
the generated icon.
+j sets Java on when taking screenshots
-j sets Java off when taking screenshots (default)
+js sets JavaScript on when taking screenshots (default)
-js sets JavaScript off when taking screenshots
+p sets browser plugins on when taking screenshots
-p sets browser plugins off when taking screenshots (default)
-d <sec> waits for <sec> seconds before taking the
screenshots.
-v makes the output verbose.
Version 0.9.7
Copyright (c) 2009-2010 Ali Rantakari, http://hasseg.org/setWeblocThumb
Automating It
If you'd like to have this program run automatically whenever you add .webloc files somewhere (e.g. by dragging them from your web browser windows), you can do this in a number of ways. If you have a license to the Hazel application, that might be easiest, but other ways are folder actions (via Automator) and launch agents, which I'll explain below.
Folder Actions
You can use Automator to create a folder action that runs setWeblocThumb whenever files are added to a particular folder.
- Open Automator and select the Folder Action template
- Select the folder you'd like to attach this action to from the combo box in the upper right-hand corner where it says "Folder Action receives files and folders added to"
- Drag the Run Shell Script action from the list in the left (it's under Utilities) to the action area on the right
- Select Pass input: as arguments in the action's settings
- Type the following into the shell script action's text field:
/usr/local/bin/setWeblocThumb "`dirname \"$1\"`" - Save
Launch Agents
A launch agent is a configuration that tells the launchd system to do something (e.g. run setWeblocThumb) when something happens (e.g. a file is added to a specific folder). An example launchd configuration file is provided with the distribution package, which asks the system to run setWeblocThumb every time the Desktop folder is modified (e.g. if some files are added there). Below are some directions on how to take it into use:
- Make a copy of the provided example launch agent configuration file into the LaunchAgents folder in your Library:
$ mkdir -p ~/Library/LaunchAgents $ cp "example launchAgents/org.hasseg.setWeblocThumb.desktop.plist" ~/Library/LaunchAgents/. - Edit this file and verify that the paths are correct (i.e. replace
your_usernamewith your actual username, or change the paths completely):
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>org.hasseg.setWeblocThumb.desktop</string> <key>ProgramArguments</key> <array> <string>/usr/local/bin/setWeblocThumb</string> <string>/Users/your_username/Desktop</string> </array> <key>WatchPaths</key> <array> <string>/Users/your_username/Desktop</string> </array> </dict> </plist> - Tell launchd to load this launch agent:
$ launchctl load ~/Library/LaunchAgents/org.hasseg.setWeblocThumb.desktop.plist
To learn more about launchd, launchctl and launch agents, please refer to Apple's documentation and the Wikipedia article.
Latest Version:
Version 0.9.7
→
Download
June 16, 2010
Changelog:
- Implemented auto-update: you can now run
setWeblocThumb -uto check for updates and optionally see the release notes and auto-update the program right from the command line.