Growlとgrowlnotifyを組み合わせてCLIからデスクトップ通知を表示する

概要

各種アプリケーションと連携してデスクトップに通知を表示するGrowlと、CLIからGrowlによる通知を行うコマンドラインツールgrowlnotifyをインストールします。



Growlのインストール

GrowlからDMGファイルをダウンロードして、インストーラを起動します。



growlnotifyのインストール

GrowlパッケージのExtrasフォルダに同梱されているインストーラを起動します。



growlnotifyを使った通知

$ growlnotify -t 'myapp' -m 'growlnotifyを使うと、CLIからGrowlに通知を送ることができます。'

-sを指定すると、明示的に閉じるまで消えない通知が作成されます。

$ growlnotify -s -t 'myapp' -m 'growlnotifyを使うと、CLIからGrowlに通知を送ることができます。'

その他のオプションは以下の通りです。

$ growlnotify -hUsage: growlnotify [-hsvuwc] [-i ext] [-I filepath] [--image filepath]
                   [-a appname] [-p priority] [-H host] [-P password]
                   [--port port] [-n name] [-A method] [--progress value]
                   [--html] [-m message] [-t] [title]
Options:
    -h,--help       Display this help
    -v,--version    Display version number
    -n,--name       Set the name of the application that sends the notification
                    [Default: growlnotify]
    -s,--sticky     Make the notification sticky
    -a,--appIcon    Specify an application name to take the icon from
    -i,--icon       Specify a file type or extension to look up for the
                    notification icon
    -I,--iconpath   Specify a file whose icon will be the notification icon
       --image      Specify an image file to be used for the notification icon
    -m,--message    Sets the message to be used instead of using stdin
                    Passing - as the argument means read from stdin
    -p,--priority   Specify an int or named key (default is 0)
    -d,--identifier Specify a notification identifier (used for coalescing)
    -H,--host       Specify a hostname to which to send a remote notification.
    -P,--password   Password used for remote notifications.
    -u,--udp        Use UDP instead of DO to send a remote notification.
       --port       Port number for UDP notifications.
    -A,--auth       Specify digest algorithm for UDP authentication.
                    Either MD5 [Default], SHA256 or NONE.
    -c,--crypt      Encrypt UDP notifications.
    -w,--wait       Wait until the notification has been dismissed.
       --progress   Set a progress value for this notification.

Display a notification using the title given on the command-line and the
message given in the standard input.

Priority can be one of the following named keys: Very Low, Moderate, Normal,
High, Emergency. It can also be an int between -2 and 2.

To be compatible with gNotify the following switch is accepted:
    -t,--title      Does nothing. Any text following will be treated as the
                    title because that's the default argument behaviour