#!/bin/sh
# sends xnotify a notification
unset TAG SEC
exec > "${XNOTIFY_FIFO:=$HOME_CACHE/xnotify.fifo}"
ug_err()
{
echo "${1}" 1>&2 && return "${2:-1}"
}
usage()
{
ug_err "usage: ${0##*/} [ -s seconds ] [ -t tag ]
[BODY]
-s seconds seconds for notification to live
-t tag category of notification"
exit
}
while getopts s:t: arg; do
case ${arg} in
s) SEC=${OPTARG};;
t) TAG=${OPTARG};;
*) usage;;
esac
done
shift $((OPTIND - 1))
printf ${SEC+SEC:%s"\t"}${TAG+TAG:%s"\t"}${2+%s"\t"}'%s\n' $SEC $TAG "$1" "$2"