[TxMt] Textmate widget & bundle

Andy Herbert andy.herbert at gmail.com
Sun Oct 22 12:18:08 UTC 2006


I've been trying to come up with a solution to creating shell scripts  
within Textmate and creating a widget on the Dashboard layer to call  
the script with references to any files or URLs passed to it, and I  
have eventually come up with a Textmate widget & bundle to do all this.

I've created a screencast (sorry - no audio) to show the various  
features of the bundle and the widget, and it can be found at:

http://homepage.mac.com/andy.herbert/Textmate-widget.mov

Features shown in the screencast include:

The actual widget is included inside the bundle and is installed in ~/ 
Library/Widgets/ the first time you call the bundle command to create  
a new widget using the currently opened document.

To call a script using the widget click on the Textmate icon, to pass  
files to the script as $1, $2.. etc drag files from Finder on to the  
Textmate icon, you can also drag a URL on to it if you have a web- 
browser open, this too is passed as $1.

If when the script is called there is any output a green icon will  
appear on the widget, and when this is clicked you will be able to  
view the output log, same goes with any errors the script throws up,  
except this time the icon is red.

Flipping the widget over will allow you to edit the widget's label or  
modify the script the widget uses. All scripts used by the widget are  
held in ~/Library/Application Support/Textmate/Widget Scripts/ and  
are deleted when you remove the widget.

Both the output and error logs are stored in ~/Library/Logs/, each  
widget has a separate file, and is deleted and re-created each time  
each script is called.

The widget bundle can be found at:

http://homepage.mac.com/andy.herbert/Widget.tmbundle.zip

I hope it might be useful to someone else on this list.




More information about the textmate mailing list