summary refs log tree commit diff
path: root/bin/hibiki/nag
blob: bf4225bcbdab96fa7f91a4fcf941ebc2bb3c2ad3 (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
25
26
27
28
29
30
31
32
33
#!/bin/sh

set -e
[ -n "$DEBUG" ] && set -x

prio=1
while getopts p:h opt; do
	case "$opt" in
	p)	prio=${OPTARG} ;;
	h|?)	printf "usage: %s [options]\n" "$(basename "$0")"
		printf "\n"
		printf "  -p PRIORITY\t (3 = swaynag, 2 = sticky notification)\n"
		printf "\n"
		exit 2 ;;
	esac
done
shift $((OPTIND - 1))

message="$1"
shift
desc="$@"

if [ ${prio} = 1 ]; then
	exe="notify-send -u normal -t 10000 ${message} ${desc}"
fi
if [ ${prio} = 2 ]; then
	exe="notify-send -u normal -t 0 ${message} ${desc}"
fi
if [ ${prio} = 3 ]; then
	exe="swaynag -s ok -m ${message} ${desc}"
fi

exec $exe