blob: b8f9a009f6b5969639771665c3ae17fcdb221aab (
plain)
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
34
35
36
37
|
#!/bin/sh
help() {
cat << EOF
${0}: Wrapper script to send notifications
options:
-s [Name] [Msg] Send Msg with Name
-s [Msg] Send Msg Without Name
-h Print this message and exit
EOF
}
err() {
for line in "${@}"; do
echo "${line}" >&2
done
exit 1
}
if ! command -v notify-send > /dev/null 2>&1; then
err "${0}: dunst must be installed"
fi
case "${1}" in
"-s")
[ ${#} -gt 3 ] && err "${0}: Invalid usage" "Try '${0} -h' for help."
notify-send "${2}" "${3}" > /dev/null 2>&1 || err "${0}: Failed to send notification"
exit 0
;;
"-h") help; exit 0 ;;
*) err "${0}: Invalid usage" "Try '${0} -h' for help." ;;
esac
|