From 6e2f124a696d7916a440ec388750bffad175d6dd Mon Sep 17 00:00:00 2001 From: John Costa Date: Mon, 28 Apr 2025 21:22:21 +0100 Subject: [PATCH] fix massive JQ thing to find the names --- scripts/toggle-speakers.bash | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/toggle-speakers.bash b/scripts/toggle-speakers.bash index 0847c61d..cd86940d 100644 --- a/scripts/toggle-speakers.bash +++ b/scripts/toggle-speakers.bash @@ -3,10 +3,14 @@ cd ~/Code/dotfiles/scripts 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 - wpctl set-default 62 + wpctl set-default $headphone_id echo "headphones" > ./status else - wpctl set-default 68 + wpctl set-default $speaker_id echo "speakers" > ./status fi