dotfiles/.i3blocks/toggle-sink

26 lines
521 B
Text
Raw Permalink Normal View History

2020-11-06 01:59:52 +01:00
#!/bin/bash
SINK="$(pactl get-default-sink)"
2020-11-06 01:59:52 +01:00
currentport=$(pactl list sinks | grep -Po "Active Port: analog-output-.*")
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
2022-08-10 18:37:33 +02:00
pactl set-sink-port "$SINK" "analog-output-headphones"
2020-12-31 11:14:20 +01:00
echo "casque"
2020-11-06 01:59:52 +01:00
else
2022-08-10 18:37:33 +02:00
pactl set-sink-port "$SINK" "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