From 06b25c3bc9777807c7312417a36f7bb7bfa10d4d Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Mon, 7 Dec 2020 21:27:57 +0100 Subject: [PATCH] Restore audio to original state after finishing a call #133 --- scripts/modem/sxmo_modemcall.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/modem/sxmo_modemcall.sh b/scripts/modem/sxmo_modemcall.sh index 334cc9a..7f91b4a 100755 --- a/scripts/modem/sxmo_modemcall.sh +++ b/scripts/modem/sxmo_modemcall.sh @@ -1,5 +1,6 @@ #!/usr/bin/env sh LOGDIR="$XDG_DATA_HOME"/sxmo/modem +ALSASTATEFILE="/tmp/precall.alsa.state" trap "gracefulexit" INT TERM modem_n() { @@ -18,7 +19,11 @@ fatalerr() { ); do mmcli -m "$(modem_n)" --voice-delete-call "$CALLID" done - alsactl --file /usr/share/sxmo/alsa/default_alsa_sound.conf restore + if [ -f "$ALSASTATEFILE" ]; then + alsactl --file "$ALSASTATEFILE" restore + else + alsactl --file /usr/share/sxmo/alsa/default_alsa_sound.conf restore + fi echo "$1">&2 notify-send "$1" setsid -f sh -c 'sleep 2; sxmo_statusbarupdate.sh' @@ -98,6 +103,7 @@ acceptcall() { else fatalerr "Couldn't initialize call with callid <$CALLID>; unknown direction <$DIRECTION>" fi + alsactl --file "$ALSASTATEFILE" store } hangup() { @@ -169,7 +175,7 @@ incallmenuloop() { xargs -0 echo | cut -d'^' -f1 | sed '/^[[:space:]]*$/d' | - awk '{$1=$1};1' | + awk '{$1=$1};1' | #this cryptic statement trims leading/trailing whitespace from a string dmenu -idx $DMENUIDX -l 14 "$([ "$WINDOWIFIED" = 0 ] && echo "-c" || echo "-wm")" -fn "Terminus-30" -p "$NUMBER" | ( PICKED="$(cat)";