#!/usr/bin/env bash # SPDX-FileCopyrightText: 2020-2021 Simon Bruder # # SPDX-License-Identifier: CC0-1.0 set -eo pipefail card=$(pactl list cards short | grep -E -o "bluez_card.*" | cut -f1) # pactl does not support any easily parsable output format profile=$(pactl list cards | rg -oU "Name: ${card}.*(\\n.*?)*.*Active Profile: (.*)" -r "\$2") pactl set-card-profile "$card" off pactl set-card-profile "$card" "$profile"