
Growl 使ってますか!Mac ユーザーの皆さん、Growl が OS X の標準機能ではないことに驚いたのも一度や二度ではありませんね!そういえば Windows 版もありますけど、使ったことないからよく知りません。
最近、Mac App Store から “Growl 1.3” がリリースされました。OS X Lion 以降に対応して170円。これを活用する『快適 Growl 術』をいくつか紹介します。
Growl があれば色んな通知が画面の端っこに表示されてとっても便利なわけですが、そもそも Growl に対応しないアプリケーションもいっぱいあります。そう、Apple 純正のアプリケーションとか。
Mail と iChat を Growl
Apple 製の Mail.app と iChat.app で Growl しちゃいましょう。この二つのアプリケーションが Growl したらとっても便利です。GrowlMail は本体から分離されましたからここでは取り上げません。[[wiki:AppleScript]] を使いましょう。
Mail


iChat


それぞれ上記のように設定しましょう。これで良い感じに Growl されますね。ちなみにこれらは Growl 1.3 と OS X Lion で動きます。古いバージョンだとちょっと変えないと動かないと思います。
適当なスクリプトを書いてコンピュータに仕事させるとき、どこまで進んでいるのか、処理が終わったのか、いちいち確認するのも面倒。そう、Growl させちゃえば良いですね。Growl 1.3 なら “GNTP (Growl Notification Transport Protocol)” に対応しています。これはネットワーク経由の通知を可能にし、さらに Windows 版とも互換性があります。これを使いましょう。
Python と Ruby から通知
Python でも Ruby でも、GNTP を利用して Growl するためのライブラリが公開されています。それを用いて、ライブラリがインストールされていれば Growl 通知し、そうでなければ標準出力にメッセージを表示するメソッドを定義してみましょう。
Python

Python では gntp
モジュールを使います。
pip install gntp
def notify(title, message):
try:
import gntp.notifier
growl = gntp.notifier.GrowlNotifier(
applicationName="Python/GNTP",
notifications=["notify"]
)
growl.register()
growl.notify(
noteType="notify",
title=title,
description=message
)
except ImportError:
print(title + ": " + message)
notify("Title", "Message")
Ruby

Ruby では ruby_gntp
クラスを使います。
gem install ruby_gntp
def notify(title, message)
begin
require 'ruby_gntp'
growl = GNTP.new("Ruby/GNTP")
growl.register(:notifications => [{
:name => "notify"
}])
growl.notify(
:name => "notify",
:title => title,
:text => message
)
rescue LoadError
puts "#{title}: #{message}";
end
end
notify('Title', 'Message')
これでタイトルとメッセージを通知できました。ライブラリがない場合でも何となく使える感じですね。GNTP を使っているので Windows でも動くはずです。
Automator

[[wiki:Automator]] からも Growl できます。簡単ですね。

気付かないといけないことに気付くことのできない皆さん、知らないうちに大切なことは過ぎ去っていきます。がんがん Growl していきましょう!