Post details: Event notifications in linux

Sep 13, 2007 : 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
Technorati tags:

Comments, Pingbacks:

No Comments/Pingbacks for this post yet...

Leave a comment:

Your email address will not be displayed on this site.
Your URL will be displayed.
What is the 2-letter abbreviation for Michigan?
Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>
Options:
 
(Line breaks become <br />)
(Set cookies for name, email & url)

<  November 2014  >
Mon Tue Wed Thu Fri Sat Sun
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

Categories


Archives

Misc

Syndicate this blog XML

powered by
b2evolution