Event notifications in linux
Envious of slick Mac notifications via Growl, I looked around for similar systems for linux. There doesn't seem to be anything quite as nice, but KDE has a knotify subsystem that is used by KDE apps and easily scriptable. And Galago has libnotify (or is it libgalago?) a gtk-based system for notifications.
I wanted to have an easy way to get notifications when a build or test suite is done running, so I wrote a few simple scripts to use knotify to do so. See Putting KNotify to work for some docs and screenshots of what it looks like. Here's the docs and code:
knotify-send
docs:
Usage:
knotify-send [TITLE] [BODY] - create a passive knotify popup
Example:
knotify-send heya! "look at me"
code:
#!/bin/bash
# Copyright Dave Brondsema
# licensed under Apache License 2.0
# inspired by galago-project.org's notify-send
if [ "$1" == "" ]; then
echo "Usage:"
full=$0
base=${full##*/}
echo " $base [TITLE] [BODY] - create a passive knotify popup"
echo
echo "Example:"
echo " $base heya! \"look at me\""
exit
fi
dcop knotify default notify eventname "$1" "$2" '' '' 16 0
knotify-done
docs:
Usage:
knotify-done [COMMAND] [ARGUMENTS...] - runs command with args, and then runs knotify when done
Examples:
knotify-done svn up
knotify-done ./configure && make && knotify-done make install
(only notifies for 'make install')
code:
#!/bin/bash
# Copyright Dave Brondsema
# licensed under Apache License 2.0
# inspired by http://sami.picobot.org/?p=19 and comments
if [ "$1" == "" ]; then
echo "Usage:"
full=$0
base=${full##*/}
echo " $base [COMMAND] [ARGUMENTS...] - runs command with args, and then runs knotify when done"
echo
echo "Examples:"
echo " $base svn up"
echo " $base ./configure && make && $base make install"
echo " (only notifies for 'make install')"
exit
fi
$@
title="Completed with exit code $?"
body=$@
dcop knotify default notify eventname "$title" "$body" '' '' 16 0
Syndicated 2007-09-14 02:17:03 from Dave Brondsema's Blog - Programming