diff --git a/scripts/core/sxmo_statusbar.sh b/scripts/core/sxmo_statusbar.sh index 68f4c15..55c9200 100755 --- a/scripts/core/sxmo_statusbar.sh +++ b/scripts/core/sxmo_statusbar.sh @@ -8,7 +8,7 @@ update() { if pgrep -f sxmo_modemcall.sh; then NOWS="$(date +"%s")" CALLSTARTS="$(date +"%s" -d "$( - grep call_start ~/.config/sxmo/modem/modemlog.tsv | + grep -aE 'call_start|call_pickup' "$XDG_CONFIG_HOME"/sxmo/modem/modemlog.tsv | tail -n1 | cut -f1 )")" diff --git a/scripts/modem/sxmo_modemcall.sh b/scripts/modem/sxmo_modemcall.sh index a31aadb..d3bb283 100755 --- a/scripts/modem/sxmo_modemcall.sh +++ b/scripts/modem/sxmo_modemcall.sh @@ -9,7 +9,7 @@ fatalerr() { mmcli -m "$(mmcli -L | grep -oE 'Modem\/([0-9]+)' | cut -d'/' -f2)" --voice-hangup-all alsactl --file /usr/share/sxmo/alsa/default_alsa_sound.conf restore notify-send "$1" - setsid -f sh -c 'sleep 2; smxo_statusbarupdate.sh' + setsid -f sh -c 'sleep 2; sxmo_statusbarupdate.sh' kill -9 0 } diff --git a/scripts/notifications/sxmo_notificationmonitor.sh b/scripts/notifications/sxmo_notificationmonitor.sh index d38e1ec..ec37204 100755 --- a/scripts/notifications/sxmo_notificationmonitor.sh +++ b/scripts/notifications/sxmo_notificationmonitor.sh @@ -23,7 +23,7 @@ handlenewnotiffile(){ if [ "$(wc -l "$NOTIFFILE" | cut -d' ' -f1)" -lt 3 ]; then echo "Invalid notification file $NOTIFFILE found (<3 lines -- see notif spec in sxmo_notifwrite.sh), deleting!" >&2 - rm "$NOTIFFILE" + rm -f "$NOTIFFILE" else sxmo_setpineled green 1; notificationhook & @@ -32,9 +32,9 @@ handlenewnotiffile(){ NOTIFMSG="$(tail -n+3 "$NOTIFFILE" | cut -c1-70)" if dunstify --action="2,open" "$NOTIFMSG" | grep 2; then - eval "$NOTIFACTION" + setsid -f sh -c "$NOTIFACTION" & elif [ -e "$NOTIFWATCHFILE" ]; then - inotifywait "$NOTIFWATCHFILE" && rm -f "$NOTIFFILE" & + (inotifywait "$NOTIFWATCHFILE" && rm -f "$NOTIFFILE") & fi fi } @@ -48,24 +48,19 @@ recreateexistingnotifs() { monitorforaddordelnotifs() { while true; do + find "$NOTIFDIR"/ -type f -mindepth 1 | read -r || sxmo_setpineled green 0 inotifywait -e create,attrib,moved_to,delete,delete_self,moved_from "$NOTIFDIR"/ | ( INOTIFYOUTPUT="$(cat)" INOTIFYEVENTTYPE="$(echo "$INOTIFYOUTPUT" | cut -d" " -f2)" - case "$INOTIFYEVENTTYPE" in - "CREATE"|"MOVED_TO","ATTRIB") - NOTIFFILE="$NOTIFDIR/$(echo "$INOTIFYOUTPUT" | cut -d" " -f3)" - handlenewnotiffile "$NOTIFFILE" - ;; - "DELETE"|"DELETE_SELF"|"MOVED_FROM") - # E.g. if no more notifications unset LED - find "$NOTIFDIR"/ -type f -mindepth 1 | read -r || sxmo_setpineled green 0 - ;; - esac + echo "$INOTIFYEVENTTYPE" | grep -E "CREATE|MOVED_TO|ATTRIB" || continue + NOTIFFILE="$NOTIFDIR/$(echo "$INOTIFYOUTPUT" | cut -d" " -f3)" + handlenewnotiffile "$NOTIFFILE" ) & wait done } pgrep -f "$(command -v sxmo_notificationmonitor.sh)" | grep -Ev "^${$}$" | xargs kill +rm -f $NOTIFDIR/incomingcall sxmo_setpineled green 0 recreateexistingnotifs monitorforaddordelnotifs diff --git a/scripts/notifications/sxmo_notificationsmenu.sh b/scripts/notifications/sxmo_notificationsmenu.sh index 722030b..d98c4d5 100755 --- a/scripts/notifications/sxmo_notificationsmenu.sh +++ b/scripts/notifications/sxmo_notificationsmenu.sh @@ -25,7 +25,7 @@ notificationmenu() { PICKEDNOTIFFILE="$(echo "$CHOICES" | grep "$PICKEDCONTENT" | cut -d^ -f2 | tr -d ' ')" NOTIFACTION="$(head -n1 "$PICKEDNOTIFFILE")" - eval "$NOTIFACTION" & + setsid -f sh -c "$NOTIFACTION" & rm "$PICKEDNOTIFFILE" }