about summary refs log blame commit diff stats
path: root/bin/notif
blob: ad1b625c2cea424280c833fe7223b743480c66ab (plain) (tree)
1
2
3
4


                              
                                                  

















                                                                        

                                                                              
#!/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 ] <TITLE> [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"