diff options
| author | Robert Günzler <r@gnzler.io> | 2020-12-07 19:00:30 +0100 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2020-12-07 19:28:05 +0100 |
| commit | a6c32d260acbca66dbe50ca5cabd278acb3597ee (patch) | |
| tree | 15a69a792f0d2f6c55ccde9284c03b4329aceaab /bin/soundswitch | |
| parent | a21306a3078ea054a8c552947412f954bec43ebf (diff) | |
bin/soundswitch: fix card profile matching
Diffstat (limited to 'bin/soundswitch')
| -rwxr-xr-x | bin/soundswitch | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/soundswitch b/bin/soundswitch index 8cd8919..52c6bc2 100755 --- a/bin/soundswitch +++ b/bin/soundswitch @@ -178,12 +178,16 @@ profile) exit 1 fi + # [^\r]#([0-9]+).*?Name: ([^\r]+).*?Profiles:\r(.*?)Active.*?(?=Card #|$) target_profile=$(pactl list cards \ | tr '\n' '\r' \ - | perl -pe 's/[^\r]index: ([0-9]+).+?name: <alsa_card.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00>\r.+profiles:\r(.+)sinks:.*?(?=index:|$)/\2\r/g' \ + | perl -pe 's/[^\r]#([0-9]+).*?Name: ([^\r]+).*?Profiles:\r(.*?)Active.*?(?=Card #|$)/\2~\3`/g' \ | tr -d '\t' \ + | tr '`' '\n' \ + | grep "${target_card}" \ + | cut -d'~' -f2- \ | tr '\r' '\n' \ - | tail -n+2 \ + | xargs -L1 \ | menu \ | perl -pe 's/^\s*([^\s]+):\s.*$/\1/') if [ -z "${target_profile}" ]; then |