dotfiles/.i3blocks/toggle-sink

25 lines
559 B
Text
Raw Normal View History

2020-11-06 01:59:52 +01:00
#!/bin/bash
2020-12-31 11:14:20 +01:00
currentport=$(pacmd list-sinks | grep -Po "active port: <analog.*")
2020-11-06 01:59:52 +01:00
if [[ -n "$button" ]]
then
if [[ "$currentport" == "active port: <analog-output-lineout>" ]]
then
pacmd set-sink-port "alsa_output.pci-0000_0b_00.3.analog-stereo" "analog-output-headphones"
2020-12-31 11:14:20 +01:00
echo "casque"
2020-11-06 01:59:52 +01:00
else
pacmd set-sink-port "alsa_output.pci-0000_0b_00.3.analog-stereo" "analog-output-lineout"
2020-12-31 11:14:20 +01:00
echo "front "
2020-11-06 01:59:52 +01:00
fi
pkill -RTMIN+10 i3blocks
else
if [[ "$currentport" == "active port: <analog-output-lineout>" ]]
then
2020-12-31 11:14:20 +01:00
echo "front "
2020-11-06 01:59:52 +01:00
else
2020-12-31 11:14:20 +01:00
echo "casque"
2020-11-06 01:59:52 +01:00
fi
fi