Skip to content

Commit 330c8d6

Browse files
committed
Fix subscribe grep filter
Sometimes, only the client event is present, to be safe, update when it's triggered.
1 parent f5ace77 commit 330c8d6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pulseaudio-control.bash

+7-1
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,15 @@ function listen() {
338338
# an event occurs.
339339
output
340340

341+
if [[ "$NODE_TYPE" == "output" ]]; then
342+
events_regex="on \(card\|sink\|server\|client\)"
343+
else
344+
events_regex="on \(card\|source\|server\|client\)"
345+
fi
346+
341347
# Listen for changes and immediately create new output for the bar.
342348
# This is faster than having the script on an interval.
343-
pactl subscribe 2>/dev/null | grep --line-buffered -e "on card" -e "on s${SINK_OR_SOURCE}" -e "on server" | {
349+
pactl subscribe 2>/dev/null | grep --line-buffered -e "$events_regex" | {
344350
while read -r; do
345351
# Output the new state
346352
output

0 commit comments

Comments
 (0)