-
Notifications
You must be signed in to change notification settings - Fork 0
/
tel-notifications
executable file
·60 lines (53 loc) · 1.71 KB
/
tel-notifications
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
54
55
56
57
58
59
#!/data/data/com.termux/files/usr/bin/bash
# format and display notifications for TEL
# by @SealyJ
# v0.3 - 15/08/2020
notifslist=~/.tel/data/notifications
ignored_pkgs=~/.tel/configs/notifications/ignored_pkgs
#pidof python >/dev/null && echo "Service is running" || echo "Service NOT running"
running=$(pgrep -f get_notifications.py)
if [ -z $1 ]; then
printf "\e[33;5;2m Notifications\e[m%s :\n"
if [ -z "$(cat $notifslist)" ] ; then
echo 'Empty'
else
while IFS= read -r line
do
echo " $line"
done < $notifslist
fi
else
option=$1
case ${option} in
-h)
echo "tel-notifications [OPTION]
'$> tel-notifications ' = show all new notifications
'$> tel-notifications -b [PKG_NAME] = block notifications from app
'$> tel-notifications -c = clear notifications list
'$> tel-notifications -r = restart notification daemon
'$> tel-notifications -h' = show this help menu"
;;
-r)
killall -q -e 'get_notifications.py'
nohup ~/.tel/scripts/get_notifications.py > /dev/null 2>&1 &
if [ "$NOTIFICATIONS_ENABLED" != 'true' ] ; then
echo -e "\e[33;5;2m Notifications\e[m: Notifications are currently disabled in config, daemon will not start unless set to true. Check config: ~/.tel/configs/notifications.sh"
else
echo -e "\e[33;5;2m Notifications\e[m: Restarted daemon"
fi
exit 0
;;
-c)
echo > $notifslist && echo -e "\e[33;5;2m Notifications\e[m: Cleared all notifications"
;;
-b)
echo $2 > $ignored_pkgs && echo -e "\e[33;5;2m Notifications\e[m: Added $2 to Ignored packages list"
exit 0
;;
esac
fi
if [ -z "$running" ]; then
echo -e " Notification daemon is not running!"
echo -e " - Use 'tel-notifications -r' to restart the daemon"
exit 1
fi