Ubuntu/Scripts/PulseAudio
From r00tedvw.com wiki
Scripts | SSL Expire | PulseAudio
stupid dock. script to change audio back to bluetooth speakers after dock crashes and recovers, but fails to set audio back to bluetooth
#!/bin/bash logfile=/var/log/bluetooth/log btsinkname=bluez_sink.60_F4_3A_71_89_E0.a2dp_sink function btcheck { logprefix=$(echo "$(date +%b" "%d" "%H":"%M":"%S) $(hostname) btcheck [$(echo $BASHPID)]:") if [[ $(cat /sys/class/bluetooth/hci0:256/power/control 2>&1 | grep -Ec "^auto") -eq 1 ]]; then echo "$logprefix connected" | tee -a $logfile userid=$(runuser -l username -c "id -u") runuser -l username -c "export XDG_RUNTIME_DIR=/run/user/$userid && pacmd set-default-sink $btsinkname 2>&1" else echo "$logprefix not connected" | tee -a $logfile fi sleep 2s btcheck } btcheck