about summary refs log tree commit diff stats
path: root/bin/notif
blob: ad1b625c2cea424280c833fe7223b743480c66ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/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"