mirror of
https://github.com/Theaninova/TheaninovOS.git
synced 2026-07-25 01:54:48 +00:00
23 lines
451 B
Bash
23 lines
451 B
Bash
set -eu
|
|
|
|
get_id() {
|
|
pw-dump | jq -r --arg name "$1" '
|
|
.[]
|
|
| select(.type == "PipeWire:Interface:Node")
|
|
| select(.info.props["node.name"] == $name)
|
|
| .id
|
|
'
|
|
}
|
|
|
|
ID_A=$(get_id "$SINK_A")
|
|
ID_B=$(get_id "$SINK_B")
|
|
|
|
CURRENT_ID=$(wpctl inspect @DEFAULT_AUDIO_SINK@ |
|
|
awk '$1 == "id" { gsub(",", "", $2); print $2 }')
|
|
|
|
if [ "$CURRENT_ID" = "$ID_A" ]; then
|
|
wpctl set-default "$ID_B"
|
|
else
|
|
wpctl set-default "$ID_A"
|
|
fi
|