-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotifier
More file actions
executable file
·36 lines (30 loc) · 772 Bytes
/
notifier
File metadata and controls
executable file
·36 lines (30 loc) · 772 Bytes
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
#!/usr/bin/env bash
## $0
##
## A simplified interface to libnotify which creates a notification which
## will stack with other similarly created (media) notifications.
##
## usage:
## notifier <summary> [<body>] [<icon name>]
set -e
((DEBUG)) && set -x
function _notification {
local summary body icon timeout
summary="$1"
body="$2"
icon="$3"
# In milliseconds
timeout="$4"
notify-send "$summary" "$body" \
$([ -n "$icon" ] && echo "--icon=$icon") \
$([ -n "$timeout" ] && echo "--expire-time=$timeout") &
}
function help {
if [ "$*[$#]" = -h -o $# -eq 0 ]
then
sed "s/## \$0/## $(basename "$0")/" "$0" | awk '/^##/{gsub("## ?", ""); printf("%s\n", $0)}'
exit 1
fi
}
help "$@"
_notification $@