From bca4475e0a7e556819c80bce8dbcf3d02ef5660c Mon Sep 17 00:00:00 2001 From: Miles Alan Date: Sat, 20 Jun 2020 08:41:02 -0500 Subject: [PATCH] Show duration of call in statusbar --- scripts/core/sxmo_statusbar.sh | 16 +++++++++++++++- scripts/modem/sxmo_modemcall.sh | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/core/sxmo_statusbar.sh b/scripts/core/sxmo_statusbar.sh index d62ea41..3148e03 100755 --- a/scripts/core/sxmo_statusbar.sh +++ b/scripts/core/sxmo_statusbar.sh @@ -5,6 +5,20 @@ UPDATEFILE=/tmp/sxmo_bar touch "$UPDATEFILE" update() { + # In-call.. show length of call + CALLINFO=" " + if pgrep -f sxmo_modemcall.sh; then + NOWS="$(date +"%s")" + CALLSTARTS="$(date +"%s" -d "$( + cat ~/.config/sxmo/modem/modemlog.tsv | + grep call_start | + tail -n1 | + cut -f1 + )")" + CALLSECONDS="$(echo $NOWS - $CALLSTARTS | bc)" + CALLINFO=" ${CALLSECONDS}s " + fi + # M symbol if modem monitoring is on & modem present MODEMMON="" pgrep -f sxmo_modemmonitor.sh && MODEMMON="M " @@ -29,7 +43,7 @@ update() { # Time TIME="$(date +%R)" - BAR=" ${MODEMMON}${VOL} ${BATSTATUS}${PCT}% ${TIME}" + BAR="${CALLINFO}${MODEMMON}${VOL} ${BATSTATUS}${PCT}% ${TIME}" xsetroot -name "$BAR" } diff --git a/scripts/modem/sxmo_modemcall.sh b/scripts/modem/sxmo_modemcall.sh index 59ce85d..852e92a 100755 --- a/scripts/modem/sxmo_modemcall.sh +++ b/scripts/modem/sxmo_modemcall.sh @@ -142,6 +142,7 @@ incallsetup() { incallmonitor() { CALLID="$1" while true; do + echo 1 > /tmp/sxmo_bar if mmcli -m "$(modem_n)" -K -o "$CALLID" | grep -E "^call.properties.state.+terminated"; then fatalerr "$NUMBER hung up the call" fi