summary refs log tree commit diff
path: root/bin/soundswitch
diff options
context:
space:
mode:
Diffstat (limited to 'bin/soundswitch')
-rwxr-xr-xbin/soundswitch8
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