notify-more

Introduction

libnotify is a notification system for the GNOME desktop environment. It comes with a command line client called notify-send. However this client is very basic. I wrote notify-more to add features I wanted, namely the abilty to add 'actions', i.e. buttons you can click that perform commands

Download

The latest version as of 23rd October 2006 is 0.3, and is available here: notify-more.py. It is released under the GNU GPL. It is written in Python. It depends on python, libnotify and the python-libnotify bindings.

I use darcs as a version control system. To check out my repositort execute the following command: darcs get http://rory.netsoc.ucd.ie/linux/notify-more/

Usage

Command line options

The command line options are intentionaly similar to notify-send.

$ notify-more -?
usage: notify-more [options]

options:
  -u LEVEL, --urgency=LEVEL
                        Specifies the urgency level (low, normal, critical)
  -t TIME, --expire-time=TIME
                        Specifies the timeout in milliseconds at which to
                        expire the notification.
  -i ICON[,ICON...], --icon=ICON[,ICON...]
                        Specifies an icon filename or stock icon to display.
  -c TYPE[,TYPE...], --category=TYPE[,TYPE...]
                        Specifies the notification category.
  -?, --help            
  -h TYPE:NAME:VALUE, --hint=TYPE:NAME:VALUE
                        Specifies basic extra data to pass. Valid types are
                        int, double, string and byte.
  -v, --version         Version of the package.
  -n ACTION_TEXT, --action-text=ACTION_TEXT
                        Text on the button for an action
  -x ACTION_CMD, --action-cmd=ACTION_CMD
                        Command to execute when this action is clicked
  -r, --replay          Replay notifications from the last hour



Sample usage

Banshee controller

notify-more -n "Play/Pause" -x "banshee --toggle-playing" -n "Next" -x "banshee --next"
            "$(banshee --hide-field --query-title) by $(banshee --hide-field --query-artist)"

This displays the following notification:
sample notification screenshot.
Clicking on the "Play/Pause" button will execute banshee --toggle-playing. Clicking on the "Next" button will cause banshee --next to be executed. The commands are executed using Python os.system(). Setting an action text of 'default' will cause the matching command to be executed when the notification is clicked, there will be no 'default' button.

Thunderbird Mailbox Alerts & notify-more

Using Mailbox Alert, and extension to Mozilla Thunderbird, you can set an arbitary command to execute when there is a new email in a mailbox. The site gives an example of how to use notify-send with mailbox alerts. wmctrl is a command line tool to interact with many window mangers, including metacity, the GNOME window manager. One can raise a window with the string "Thunderbird" in it by usig the command wmctrl -a Thunderbird.

It was the desire to integrate this command with notifications that led me to create notify-more. Soecify the following command in the following alert:

/path/to/notify-more --icon=/usr/share/pixmaps/mozilla-thunderbird.png -n Show -x wmctrl\ -a\ Thunderbird Email\ from\ %sendername %subject
and you can get the following mailbox alert:
example of thunderbird mailbox alerts & notify-more
Clicking on the 'Show' button, will switch you to the workspace thunderbird is on, raise it, and bring it to the front.

Replay

Notifications are usefully because they notify you of things (obviously), but what if you're away from your desk when that notification came. You'd know nothing. New in version 0.3 of notify-more, is a the abilty to record all the notifications that were sent and the ability to replay them later.

To store notifications for 24 hours, create a directory "~/notify-more".

To replay all notifications from the last hour, execute notify-more --replay

Everytime notify-more is called notifications older than 24 hours are deleted. The ability to change the 24 hours or 1 hour range will be added in future versions

Feedback

For any questions, comments or feedback, please email the author at image of email to fool spammers, sorry visually affect visitors. I also maintain a blog, please see the notify-more category for news.

Changes