dotfiles/.i3blocks/toggle-sink

25 lines
543 B
Text
Raw Normal View History

2020-11-06 01:59:52 +01:00
#!/bin/bash
currentport=$(pacmd list-sinks | grep -Po "active port:.*")
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"
echo "head"
else
pacmd set-sink-port "alsa_output.pci-0000_0b_00.3.analog-stereo" "analog-output-lineout"
echo "line"
fi
pkill -RTMIN+10 i3blocks
else
if [[ "$currentport" == "active port: <analog-output-lineout>" ]]
then
echo "line"
else
echo "head"
fi
fi