Notification patch v4

This commit is contained in:
iressa 2020-07-31 19:34:12 -04:00 committed by Miles Alan
parent dcf5ddd77c
commit e6635ba7ef
7 changed files with 102 additions and 16 deletions

View file

@ -1,6 +1,7 @@
#!/usr/bin/env sh
trap gracefulexit INT TERM
WIN=$(xdotool getwindowfocus)
NOTIFDIR="$XDG_CONFIG_HOME"/sxmo/notifications
gracefulexit() {
echo "Gracefully exiting $0"
@ -339,8 +340,16 @@ getprogchoices() {
# E.g. sets CHOICES var
programchoicesinit "$@"
# Decorate menu at top w/ notifications if they exist
NOTIFICATIONS="$(find "$NOTIFDIR"/* -type f | grep -vc "sxmo_incomingcall" || echo 0)"
echo "$NOTIFICATIONS" | grep -v 0 &&
CHOICES="
Notifications ($(echo "$NOTIFICATIONS" | cut -d " " -f1)) ^ 0 ^ sxmo_notifications.sh
$CHOICES
"
# Decorate menu at top w/ incoming call entry if present
INCOMINGCALL="$(cat /tmp/sxmo_incomingcall || echo NOCALL)"
INCOMINGCALL="$(cat "$NOTIFDIR"/sxmo_incomingcall || echo NOCALL)"
if echo "$INCOMINGCALL" | grep -v NOCALL; then
CALLID="$(echo "$INCOMINGCALL" | cut -d: -f1)"
CALLNUM="$(echo "$INCOMINGCALL" | cut -d: -f2)"
@ -403,4 +412,4 @@ pgrep -f "$(command -v sxmo_appmenu.sh)" | grep -Ev "^${$}$" | xargs kill -TERM
DMENUIDX=0
PICKED=""
ARGS="$*"
mainloop
mainloop