Skip to content

Commit

Permalink
volume-pipewire: use default sink if inactive
Browse files Browse the repository at this point in the history
If all of the sinks are inactive, fall back to the default sink instead
of saying "audio inactive". This allows changing the volume while no
audio is playing.
  • Loading branch information
psvenk committed Nov 26, 2021
1 parent 1105c0b commit 86ab647
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion volume-pipewire/volume-pipewire
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ function print_format {
}

function print_block {
ACTIVE=$(pactl list sinks | grep "State\: RUNNING" -B4 -A55 | grep "Name:\|Volume: \(front-left\|mono\)\|Mute:\|api.alsa.pcm.card = \|node.nick = ")
ACTIVE="$(pactl list sinks | grep "State\: RUNNING" -B4 -A55)"
if [[ $ACTIVE = "" ]] ; then
ACTIVE="$(pactl list sinks | grep "$(pactl get-default-sink)" -B4 -A55)"
fi
ACTIVE="$(echo "$ACTIVE" | grep "Name:\|Volume: \(front-left\|mono\)\|Mute:\|api.alsa.pcm.card = \|node.nick = ")"
for Name in NAME MUTED VOL INDEX NICK; do
read $Name
done < <(echo "$ACTIVE")
Expand Down

0 comments on commit 86ab647

Please sign in to comment.