dotfiles/.i3blocks/toggle-sink

25 lines
554 B
Plaintext
Raw Normal View History

2020-11-06 01:59:52 +01:00
#!/bin/bash
2021-02-04 17:44:55 +01:00
currentport=$(pactl list sinks | grep -Po "Active Port: analog.*")
2020-11-06 01:59:52 +01:00
if [[ -n "$button" ]]
then
2021-02-04 17:44:55 +01:00
if [[ "$currentport" == "Active Port: analog-output-lineout" ]]
2020-11-06 01:59:52 +01:00
then
2021-02-22 01:28:33 +01:00
pactl 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
2021-02-22 01:28:33 +01:00
pactl 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
2021-02-04 17:44:55 +01:00
if [[ "$currentport" == "Active Port: analog-output-lineout" ]]
2020-11-06 01:59:52 +01:00
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