2011年1月4日星期二

Growl Notification from iTerm 2

The iTerm 2 project has been around for a while, but it recently caught my attention again as development has become very active recently. Recent versions of iTerm support Growl notifications which is one of my favorite feature.

To enable the Growl notification, Go to Preferences->AdvancedSettings, Check the Enable Growl notifications.



To initiate Growl events from the command line in iTerm with:
echo $'\e]9;Growl Notification\007'

The example shows how to get an alert after a long make. I know I would never remember that command so I wrote a little Bash user defined function to do the same. Add this to ~/.bash_profile file:

growl() { echo -e $'\e]9;'${1}'\007' ; return ; }

Now the command to initiate a notification would be:

make; growl "make done"

Reference:
http://sites.google.com/site/iterm2home/
http://code.google.com/p/iterm2/
http://widgetterm.sourceforge.net/
  • rss
  • Del.icio.us
  • Digg
  • Twitter
  • StumbleUpon
  • Reddit
  • Share this on Technorati
  • Post this to Myspace
  • Share this on Blinklist
  • Submit this to DesignFloat

5 意見:

Andrei 提到...

But what do you do when the command you want to run is remote?

Simple: Terminal Bell. Make iTerm send Growl alerts for Terminal Bells then run your command like this:

make; echo ^G


where ^G is a control character obtained with Ctrl+v, Ctrl+g

AMing 提到...

I have not tried the command run in remote. Do you have idea on it.

Shashi Kant Sharma 提到...

Use this to give multi words arguments without requiring quotes:

growl() { echo -e $'\e]9;'${*}'\007' ; return ; }

Stephan 提到...

Does Growl still work for iTerm 2 on OS X Lion?

I just upgraded today to 10.7.2 from Snow Leopard, and Growl no longer seems to be working for me.

I'm using iTerm 1.0.0.20111020 and Growl 1.2.2.

Chris B 提到...

I couldn't make this work, but there is (now) a utility called 'growlnotify' to do the same thing: http://growl.info/extras.php

張貼意見