dots


dots / config / .local / bin
xxwhirlpool  ·  2026-03-04

switchbluez

 1#!/usr/bin/env bash
 2#
 3# borrowed from some AI slop:
 4# https://gist.github.com/sanskar10100/fa2eb78bcf431cec28dde509dd797288
 5
 6device_name=$(pactl list cards | grep -B 20 "device.form_factor = \"headset\"" | grep "Name" | awk '{print $2}')
 7
 8goodaudio() {
 9	pactl set-card-profile "$device_name" a2dp-sink-sbc_xq
10	echo "switched to SBC-XQ"
11}
12
13micaudio() {
14	pactl set-card-profile "$device_name" headset-head-unit-msbc
15	echo "switched to mSBC"
16}
17
18choice() {
19	choose=$(gum choose "listen" "mic")
20	case "$choose" in
21		*listen) goodaudio ;;
22		*mic) micaudio ;;
23		*) exit 1;;
24	esac
25}
26
27choice