I3 to Sway #1

Merged
dbroqua merged 112 commits from gentoo-sway into master 2021-10-21 21:40:49 +02:00
Showing only changes of commit 2ed87535fc - Show all commits

39
bin/btswitch.sh Executable file
View file

@ -0,0 +1,39 @@
#! /bin/bash
HEADPHONE="88:D0:39:7D:6A:70"
SPEAKERS="EC:81:93:94:92:73"
if [ -z "$1" ]; then
echo "Missing profil"
echo "example: btswitch.sh <headphone|speakers>"
exit 1
fi
case ${1} in
headphone)
bluetoothctl disconnect ${SPEAKERS}
bluetoothctl connect ${HEADPHONE}
# INFO: Dirty
sleep 5
;;
speakers)
bluetoothctl disconnect ${HEADPHONE}
bluetoothctl connect ${SPEAKERS}
;;
*)
echo "Unknown mode"
exit 1
esac
OUTPUTID=`pactl list short sinks|grep bluez|cut -f 1`
echo "Set Bluetooth as default output"
pacmd set-default-sink ${OUTPUTID}
echo "Move streams to default output"
pactl list short sink-inputs|while read stream; do
streamId=$(echo $stream|cut '-d ' -f1)
echo "moving stream $streamId"
pactl move-sink-input "$streamId" "${OUTPUTID}"
done