From cbdd80cde42aa46159d6b26042bbeb69ebe81425 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Tue, 25 Jun 2024 05:54:21 -0400 Subject: [PATCH] convert pacmd to pactl due to its removal --- brc2 | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/brc2 b/brc2 index 58703b4..4c5e423 100644 --- a/brc2 +++ b/brc2 @@ -118,7 +118,7 @@ multimic() { m pactl unload-module module-null-sink m pactl unload-module module-remap-source - IFS=" " read -r -a sources <<<"$(pacmd list-sources | sed -rn 's/.*name: <([^>]+).*/\1/p')" + IFS=" " read -r -a sources <<<"$(pactl -f json list sources|jq -r '.[].name')" if (( ! $# )); then i=0 @@ -4253,18 +4253,19 @@ fixu() { # unmute desktop output um() { - local sink card sedcmd + local sink card sink=$(pactl get-default-sink) if [[ $sink == auto_null ]]; then - # guessing there is just one with an off profile. otherwise we will - # need some other solution, like storing the card identifier that we - # muted with nap. Or, we could so some hakery with - # pactl -f json. - sedcmd='/^[[:space:]]*index:/{s/^[[:space:]]*index://;h};/^[[:space:]]*active profile: $/{g;p;q}' - card=$(pacmd list-cards | sed -n "$sedcmd") - m pacmd set-card-profile "$card" output:analog-stereo + # this assumes there is just one with an off profile. otherwise we will + # need to do something else like storing the card name we care + # about somewhere. the nap function picks a card, it could help. + card=$(pactl -f json list cards|jq '.[] | select(.active_profile? == "off")|.index') + if [[ $card ]]; then + m pactl set-card-profile "$card" output:analog-stereo + else + echo "iank note: no muted card found. still unmuting sink" + fi fi - m pactl set-sink-mute @DEFAULT_SINK@ false rm -f /tmp/ianknap } -- 2.30.2