TextMate News

Anything vaguely related to TextMate and macOS.

New Dialog System for Commands

Included with the latest build of TextMate (r1305) is a new system for presenting dialogs. The new system allows you to create a custom interface in Interface Builder and then ask TextMate to present it as was it native. This is without writing any code at all.

I have recorded a screencast which introduces the system and shows basic usage.

The screencast is part one of what I plan to be a four or five part series with the upcoming screencasts covering the following topics:

  • Using buttons in the dialog (for actions)
  • Handling selections in lists and outlines
  • Showing progress visually
  • Putting it all together

Update (2007-03-15): After this screencast was recorded, a change was made: the tm_dialog binary has been moved from Support/bin to be within the Dialog.tmPlugIn package. That way, the version of the shell command should always match that of the installed plug-in (i.e. if you install a newer version of the plug-in). To get the exact path of the tm_dialog shell command, in TextMate type: echo "$DIALOG" and press ⌃R (to execute that line). In your scripts, you should always access tm_dialog as just "$DIALOG" (that would be ENV['DIALOG'] for Ruby).

Another common troubleshooting item is running: "$DIALOG" «nib» and then not see a window. If you do not specify -p/--parameters then tm_dialog will read parameters from the standard input. So either press ⌃D to “close” stdin, or give -p '{}' as argument, and things should work as expected.

categories Screencasts


Absolutely unbelievable! I find it hard to express myself right now, my mind is filled with possibilities. I foresee a lot of work ahead of me, in the various bundles I’m working on. :)

Looking forward to the other screencasts.

27 October 2006

by Jay Soffian

Allan, very, very clever.


27 October 2006

by Jay Soffian

BTW, the movie seems to end kind of suddenly. Was it truncated by accident?

Fantastic! The possibilities are endless.

Very nice!

It does end abruptly, though, as Jay mentioned.

I’d love to see the rest, looks very promising. I can’t wait to see the rest of it.

28 October 2006

by Ned Baldessin

Briliant! Bravo!

Wow man, you have way to much skill. i was watching and i was just amazed, this stuff is just to easy once you get it. i have to give it a try sometime.

Anyway, thanks Allan, you’re just awesome incarnate


It’s simply amazing… Allan, you’re a genius !

Just had to echo the comments here: Pure Genius.

Watching this put a great big smile on my face. :) <- there it is!

28 October 2006

by Chriztian Steinmeier

It’s always a sublime treat to watch your screencasts - the “moneyshot” in this one is where you miss-spell “cruel” by writing “curel”, and instead of doing what every other creature on this planet would have done (delete and rewrite) you actually pull out the “Transpose” command which swaps ‘u’ & ‘r’ - monster chops, ha! :-)

It’s stuff like this that highlights the genius of Allan.

Totally awesome.

Fantastic, Allan. This is amazing stuff!

Very nice stuff. Speaks volumes about your skills and the power of the environment OS X developers work in.

Imagine doing this without a UNIX shell with pipes and STDIN/STDOUT, meaningful support for high-level languages like Ruby/Python, Cocoa, Cocoa Bindings and Key-Value-Coding, Interface Builder, etc…

My god! It’s like MPW is reborn. Genius, dude.

i really loved this demonstration. we learn about your fantastic application and you teach us about bindings and some functionality of interface builder I have so far missed [the make sub-views stuff] Very very cool. Thanks

Loved the halloween additions to the newest rev… very fun. For a moment I thought that - gasp - I had some kind of weird virus that was - gasp - asking me if I, if I - oh… wanted to review my documents for unsaved changes before I quit… Sweet, new TM.

i love the halloweener updates, those are slick!

30 October 2006

by Joe User

The icon made my day. I bought TextMate on the spot because of it. This sounds insane, but man, it’s the little things for me. More silly easter eggs to make a programmer’s life more interesting, please!

Any chance of posting the nib you generated during the demo?

30 October 2006

by Mike Ter Louw

Great pumpkin icon, Allan! Thanks. :)

Happy Halloween! Late night coding surprise :)

That was cool! So cool, that i made a blogentry about the TextMate Halloween Editon! Happy Halloween and thanks for that great editor!

I enjoyed the Halloween surprise. Programming TextMate is obviously fun for you!

About the Halloween icon. It is so much cooler than the proper Textmate icon, that I don’t want to you revert back to the old one. I design user-interfaces and I can tell you that there is something about that icon that makes me want to use Textmate more that I do already.

Don’t you dare remove it!

If anyone wants it, I pull it out of the package: TextMate.icns

Thanks alot! I’ve just built a build selection dialog for selecting ant targets and it works just great. So now I don’t really need to change the build.xml default build or build from the commandline anymore. Thank you!

I might be missing the point, but is the idea to create custom dialogs to use only within TextMate? Or to be able to roll out scripts that present nib based dialogs on their own (without TextMate present)?

Alex. The idea is to use scripts to set up a dialog interface and receive a return value. The nibs load into TextMate which makes the dialogs part of TextMate. As I wrote above, I just wrote some scripts, xsl and created a nib so that I can choose the ant target I wish to run from a standard cocoa dropdown. This integrates ant into TextMate even further while still keeping the flexibility of TextMate.

Wow! i thought CocoaDialog is a powerfull way for doing simple dialogs in Bundles but this is just WOW. i think i’ll have to remake the Get Bundle

Great Tool!! When can we expect more information on the usage of tm_dialog? Is there some kind of documentation available? Thanks!

Stefan: This letter mentions how to hook up buttons.

There isn’t much specific to say about tm_dialog since most is related to how Interface Builder and bindings work.

But I will do new screencasts with some common tasks when time permits. I probably will also write up a page or two with technical details, again, when time permits.

Allan: Thank you for your hint.

It took some time to figure out that the method has to be named “performButtonClick” in order to close the dialog window. I think the following post might be helpful: http://www.mail-archive.com/textmate-dev@lists.macromates.com/msg00840.html

08 April 2009

by matthew

Any chance there is an updated example available that shows how to do this (using “$DIALOG” now), within a shell script or terminal?

Just a basic example of setting default values and getting user input from UI files built with Interface Builder would be really helpful. There is very little documentation available now that everything has been updated.

matthew: If you have a svn checkout:

cd /Library/Application\ Support/TextMate/Bundles
find . -name .svn -prune -or -name \*.tmCommand -exec grep -sq DIALOG {} \; -print

There should be at least a dozen default bundles which use $DIALOG. None of them are using v2 (yet), but v1 is not going anywhere.

10 April 2009

by matthew

Thanks for the response Allan, i am combing through the examples and trying to make sense of them.

Trying to find a modern example of exactly what you showed in the first half of the screencast. Using Interface builder to get some input from the user.

This is not working for me.