Textmate Project Widget

To stay organised with all that stuff I write with TextMate, I use a few Textmate projects — for some general stuff, all kinds of smaller and larger Ruby code and, of course some Ruby on Rails.

And to stay organised with these project files which are spread the same way as the project directories are — I use the TextMateProject widget which is available form Mac OS X Nusings. This was created and improved by Eric and Anthony.

While most of these project files in fact live somewhere inside my home directory and are searched for and found by the widget, others are located on my iDisk and are not found (and consequently as software is they aren’t listed either). As the widget doesn’t even search on that iDisk, that’s not so too surprising.

Please note: The following involves editing files in the Library folder in your home directory which might break something on your computer. So as with all software and code lines made available like this: I make no warranties, express or implied, including without limitation the implied warranties of non-infringement, merchantability and fitness for a particular purpose in any way.

In other words: As you’re reading this, I suppose you are a software professional of some kind and you know what you do to your comuter. You act responsibly — and backup your computer regularly anyway, but certainly before you apply anything coming from the net. But in case you’re not familiar with writing or changing code, this is probably not for you.

But now, without further ado, I went into my 1st bit of JavaScript programming, to add listing of the project files on the iDisk to the projects widget. So if you’d like to do the same — here is what I did:

Download and install the TextMate Projects widget from the location given above. Now the widget should be located in this directory: /Users//Library/Widgets/TextMate Projects.wdgt. With a CTRL click your can open the contextual menu and then select “Show Package Contents”. In that directory there is a directory Scripts and inside that you should find Scroller.js. That’s what I edited:

Open that file in you favourite editor TextMate and got to ~ line 115. The 1st line is there already — I added the 2nd one:

projects = (widget.system('mdfind -onlyin ~ "kMDItemKind == 'TextMate project'"', 
projects = projects.concat( (widget.system('mdfind -onlyin /Volumes/iDisk 
                 "kMDItemKind == 'TextMate project'"', null).outputString).split("n"));

Save this file and you’re done.

Is there a more ‘javascriptesque’ way to do this?
Is there something like += for Arrays in JavaScript?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s