Skip to content

Instantly share code, notes, and snippets.

@Brainiarc7
Forked from emmaly/gist:8267078
Created January 5, 2014 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Brainiarc7/8267202 to your computer and use it in GitHub Desktop.
Save Brainiarc7/8267202 to your computer and use it in GitHub Desktop.
#!/bin/bash
sink_name="bluez_sink.00_42_1B_AD_FA_CE"
if [ -z "$1" ]; then
dbus-monitor --system "path=/org/bluez/777/hci0/dev_00_42_1B_AD_FA_CE, interface=org.bluez.AudioSink, member=Connected" | while read line; do
echo $line
$0 1
done
else
if pacmd list-sinks | grep -qi $sink_name; then
if pactl stat | grep -qi $sink_name; then
echo "Already done."
else
echo "Setting profile..."
pactl set-card-profile bluez_card.00_42_1B_AD_FA_CE a2dp
echo "Setting sink..."
echo "set-default-sink $sink_name" | pacmd > /dev/null
echo "Setting volume..."
pactl -- set-sink-volume $sink_name 0
pactl -- set-sink-volume $sink_name +50%
fi
else
echo "Not connected."
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment