marioortizmanero / polybar-pulseaudio-control

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

Port names containing whitespace are not supported #83

Closed nchachereau closed 2 months ago

nchachereau commented 1 year ago

Hello,

I've been using this script for quite some time now (probably over 2 years), thank you so much for all the work you put in it.

Recently I bought a new laptop, and on this machine, with Ubuntu 22.04.2, pactl list sinks reports ports as e.g. [Out] Speaker or [Out] Headphones. Unfortunately, the script only matches on [Out], which makes it impossible to use --node-nickname to distinguish between headphones and laptop speakers (by displaying different icons) .

One possible fix is to change awk '/Active Port: / {print $3}' with awk '/Active Port: / {print $3$4}' in getNodeName() (so that I can match on [Out]Speaker).

That simple fix works for my use case, and does not seem to cause issues when the port description does not contain spaces, but I don't know how generalizable you would want the solution to be here. What if there are more than two fields? Do you want to account for that? Maybe use something else than awk and simply return everything that follows Active Port:?