Cleanup hooks

This add a script to use either the user hook or the default one.

Sometime we checked the user hook or a default code. We move this
default code in a defaut hook.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This commit is contained in:
Stacy Harper 2021-06-29 19:21:00 +02:00 committed by Maarten van Gompel
parent 0ed27f8538
commit e6ea657634
22 changed files with 160 additions and 254 deletions

View file

@ -10,20 +10,6 @@ gracefulexit() {
kill -9 0
}
notificationhook() {
if [ -x "$XDG_CONFIG_HOME"/sxmo/hooks/notification ]; then
"$XDG_CONFIG_HOME"/sxmo/hooks/notification "$@"
else
VIBS=5
VIBI=0
while [ $VIBI -lt $VIBS ]; do
sxmo_vibratepine 400 &
sleep 0.5
VIBI=$(echo $VIBI+1 | bc)
done
fi
}
handlenewnotiffile(){
NOTIFFILE="$1"
@ -31,7 +17,7 @@ handlenewnotiffile(){
echo "Invalid notification file $NOTIFFILE found (<3 lines -- see notif spec in sxmo_notifwrite.sh), deleting!" >&2
rm -f "$NOTIFFILE"
else
notificationhook "$NOTIFFILE" &
sxmo_hooks.sh notification "$NOTIFFILE" &
NOTIFACTION="$(awk NR==1 "$NOTIFFILE")"
NOTIFWATCHFILE="$(awk NR==2 "$NOTIFFILE")"
NOTIFMSG="$(tail -n+3 "$NOTIFFILE" | cut -c1-70)"