marioortizmanero / polybar-pulseaudio-control

A feature-full Polybar module to control PulseAudio
MIT License
478 stars 49 forks source link

External sink change causes bad array subscript error #41

Closed OJFord closed 3 years ago

OJFord commented 3 years ago

If the sink changes externally to pulseaudio-control, for example, an active bluetooth device disconnects, the output of listen changes to line 61: SINK_NICKNAMES["$sinkName"]="$nickname": bad array subscript.

It fixes on sink change if you rotate back through to the same one, but of course that's only a workaround, and also requires that more than one sink is still present. (If you're hitting this issue and have only one sink left, the other option is restarting the polybar.)

marioortizmanero commented 3 years ago

I don't exactly understand how you reproduce this. I tried disconnecting my headphones (wired) while they were active (in curSink), and all that happened was that it swapped to my speakers (I only have headphones and speakers). Does this only happen with a single available sink?

OJFord commented 3 years ago

Were you using (at least) one of --sink-nicknames-from or --sink-nicknames? Would be needed to hit that line.

Does your headphone sink get removed when their disconnected (not shown in pavucontrol for example), or just disabled or something perhaps?

Happens for me if the current sink is my Bluetooth earphones and I turn them off, battery dies, or I go out of range: sink switches to speakers, but instead of 'Built-in Audio Analog Stereo' it shows this error.