Other pages

Other software/code by me

Download Appcast: RSS 2.0
$SW_DISPLAY_NAME icon

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:

screenshot

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:]

  -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.3
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), I suggest using a launch agent. 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:

  1. 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/.
    	
  2. Edit this file and verify that the paths are correct (i.e. replace your_username with 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>
    	
  3. 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.

Also note that you can achieve similar functionality (i.e. run setWeblocThumb every time files are added to a particular folder) by other means as well, such as folder actions and the Hazel application. I use launchd simply because folder actions don't quite work for me (on Mac OS 10.5.7) and I don't own a license to Hazel.

 

setWeblocThumb is written in Objective-C and C, using the OS X Cocoa and Carbon APIs. It is licensed under the Apache License version 2.0 and requires Mac OS 10.5 (Leopard) or later.
Copyright © 2009-2010 Ali Rantakari.

Source code is available in a Git repository (click here to show/hide):
 

Latest version:

Version 0.9.3      →    Download
February 07, 2010

Changelog:

  • Support for site favicons is now properly implemented; favicons specified in the page source as link elements are handled as well.
 

Older versions:

Show/hide older versions