Skip to content

Commit

Permalink
fix port stripped on white space
Browse files Browse the repository at this point in the history
When the port is something like "[Out] Speaker" the previous awk call
only extracted "[Out]".

Co-authored-by: Nicolas Chachereau <nicolas@nchachereau.ch>
  • Loading branch information
fabian-thomas and nchachereau committed May 12, 2024
1 parent 09c7a2a commit 1be01ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pulseaudio-control.bash
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function getCurVol() {
# `nodeName`.
function getNodeName() {
nodeName=$(pactl list "s${SINK_OR_SOURCE}s" short | awk -v sink="$1" "{ if (\$1 == sink) {print \$2} }")
portName=$(pactl list "s${SINK_OR_SOURCE}s" | grep -e "S${SINK_OR_SOURCE} #" -e 'Active Port: ' | sed -n "/^S${SINK_OR_SOURCE} #$1\$/,+1p" | awk '/Active Port: / {print $3}')
portName=$(pactl list "s${SINK_OR_SOURCE}s" | grep -e "S${SINK_OR_SOURCE} #" -e 'Active Port: ' | sed -n "/^S${SINK_OR_SOURCE} #$1\$/,+1p" | awk -F ": " '/Active Port: / {print $2}')
}


Expand Down

0 comments on commit 1be01ad

Please sign in to comment.