Growl for Linuxを使ってみた

http://image.hexacosa.net/images/container/000000000000041b_M.png

mattnさんがGrowl for Linuxを開発されている ということを聞いて、 さっそく使ってみました。 環境はUbuntu11.04です。

インストール

Ubuntuはパッケージが用意されているので、それを利用します。

$ sudo add-apt-repository ppa:mattn/growl-for-linux
$ sudo apt-get update
$ sudo apt-get install growl-for-linux

Pythonで通知してみる

Pythonで通知したい場合は、gntpクライアントである kfdm/gntp を使います。

通知スクリプトは以下のような感じです。

# coding: utf-8
import gntp
from gntp.notifier import GrowlNotifier


notifier = GrowlNotifier("python script", ["TEST"], hostname="0.0.0.0")
notifier.debug = True
notifier.register()     # only once
notifier.notify("TEST", "タイトルふぉー", "本文ふぉー\n2行目フォー")

すばらしいですね。