fix massive JQ thing to find the names

This commit is contained in:
2025-04-28 21:22:21 +01:00
parent 98d8d45529
commit 6e2f124a69

View File

@ -3,10 +3,14 @@
cd ~/Code/dotfiles/scripts cd ~/Code/dotfiles/scripts
status=$(cat ./status) status=$(cat ./status)
speaker_id=$(pw-dump | jq 'map(select(.type == "PipeWire:Interface:Node" and .info.props.["media.class"] == "Audio/Sink" and .info.props.["alsa.card_name"] == "HDA NVidia")) | map({"id"}) | .[].id')
headphone_id=$(pw-dump | jq 'map(select(.type == "PipeWire:Interface:Node" and .info.props.["media.class"] == "Audio/Sink" and .info.props.["alsa.card_name"] == "Razer Kraken Kitty Edition")) | map({"id"}) | .[].id')
if [ $status == "speakers" ]; then if [ $status == "speakers" ]; then
wpctl set-default 62 wpctl set-default $headphone_id
echo "headphones" > ./status echo "headphones" > ./status
else else
wpctl set-default 68 wpctl set-default $speaker_id
echo "speakers" > ./status echo "speakers" > ./status
fi fi