|
|
@ -1,6 +1,12 @@ |
|
|
|
#!/usr/bin/env sh |
|
|
|
#!/usr/bin/env sh |
|
|
|
|
|
|
|
trap gracefulexit INT TERM |
|
|
|
NOTIFDIR="$XDG_CONFIG_HOME"/sxmo/notifications |
|
|
|
NOTIFDIR="$XDG_CONFIG_HOME"/sxmo/notifications |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gracefulexit() { |
|
|
|
|
|
|
|
echo "Gracefully exiting $0" |
|
|
|
|
|
|
|
kill -9 0 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
notificationhook() { |
|
|
|
notificationhook() { |
|
|
|
if [ -x "$XDG_CONFIG_HOME"/sxmo/hooks/notification ]; then |
|
|
|
if [ -x "$XDG_CONFIG_HOME"/sxmo/hooks/notification ]; then |
|
|
|
"$XDG_CONFIG_HOME"/sxmo/hooks/notification |
|
|
|
"$XDG_CONFIG_HOME"/sxmo/hooks/notification |
|
|
@ -42,11 +48,9 @@ recreateexistingnotifs() { |
|
|
|
|
|
|
|
|
|
|
|
monitorforaddordelnotifs() { |
|
|
|
monitorforaddordelnotifs() { |
|
|
|
while true; do |
|
|
|
while true; do |
|
|
|
INOTIFYOUTPUT="$( |
|
|
|
inotifywait -e create,moved_to,delete,delete_self,moved_from "$NOTIFDIR"/ | ( |
|
|
|
inotifywait -e create,moved_to,delete,delete_self,moved_from "$NOTIFDIR"/ |
|
|
|
INOTIFYOUTPUT="$(cat)" |
|
|
|
)" |
|
|
|
|
|
|
|
INOTIFYEVENTTYPE="$(echo "$INOTIFYOUTPUT" | cut -d" " -f2)" |
|
|
|
INOTIFYEVENTTYPE="$(echo "$INOTIFYOUTPUT" | cut -d" " -f2)" |
|
|
|
|
|
|
|
|
|
|
|
case "$INOTIFYEVENTTYPE" in |
|
|
|
case "$INOTIFYEVENTTYPE" in |
|
|
|
"CREATE"|"MOVED_TO") |
|
|
|
"CREATE"|"MOVED_TO") |
|
|
|
NOTIFFILE="$NOTIFDIR/$(echo "$INOTIFYOUTPUT" | cut -d" " -f3)" |
|
|
|
NOTIFFILE="$NOTIFDIR/$(echo "$INOTIFYOUTPUT" | cut -d" " -f3)" |
|
|
@ -57,9 +61,11 @@ monitorforaddordelnotifs() { |
|
|
|
find "$NOTIFDIR"/ -type f -mindepth 1 | read -r || sxmo_setpineled green 0 |
|
|
|
find "$NOTIFDIR"/ -type f -mindepth 1 | read -r || sxmo_setpineled green 0 |
|
|
|
;; |
|
|
|
;; |
|
|
|
esac |
|
|
|
esac |
|
|
|
|
|
|
|
) & wait |
|
|
|
done |
|
|
|
done |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pgrep -f "$(command -v sxmo_notificationmonitor.sh)" | grep -Ev "^${$}$" | xargs kill |
|
|
|
sxmo_setpineled green 0 |
|
|
|
sxmo_setpineled green 0 |
|
|
|
recreateexistingnotifs |
|
|
|
recreateexistingnotifs |
|
|
|
monitorforaddordelnotifs |
|
|
|
monitorforaddordelnotifs |
|
|
|