-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstantnotifytrigger.sh
executable file
·53 lines (43 loc) · 1.57 KB
/
instantnotifytrigger.sh
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/dash
# gets executed each time dunst receives a notification
[ -e ~/.config/instantos ] || mkdir -p ~/.config/instantos/
if ! [ -e ~/.config/instantos/notifyignore ]; then
echo "creating notifyignore"
cat /usr/share/instantnotify/notifyignore >~/.config/instantos/notifyignore
fi
if ! [ -e ~/.config/instantos/notifysilent ]; then
echo "creating notifyignore"
cat /usr/share/instantnotify/notifysilent >~/.config/instantos/notifysilent
fi
if grep -Fiq "$1" ~/.config/instantos/notifyignore || [ "$1" = "instantASSIST" ]
then
echo "ignoring notification from $1"
exit
fi
# some apps dont need/already have notification sounds
if ! grep -iqF "$1" ~/.config/instantos/notifysilent && ! iconf -i mutenotifications; then
# play notification sound
if ! [ -e ~/instantos/notifications/notification.ogg ]; then
if checkinternet; then
mkdir -p ~/instantos/notifications/
wget -qO ~/instantos/notifications/notification.ogg \
"http://notificationsound.surge.sh/notification.ogg"
else
exit
fi
fi
if ! iconf -i nonotify; then
if [ -e ~/instantos/notifications/customsound ]; then
mpv --keep-open='no' ~/instantos/notifications/customsound
else
mpv --keep-open='no' ~/instantos/notifications/notification.ogg
fi
fi
fi &
# instantmenu crashes when displaying messages that are too long
if echo "$3" | grep -E '.{500,}'; then
CONTENTS="message too long to display"
else
CONTENTS="$3"
fi
instantnotifyctl a "$1" "$2" "$CONTENTS"