marioortizmanero / polybar-pulseaudio-control

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

added ability to give nicknames to different ports #43

Closed SPFabGerman closed 3 years ago

SPFabGerman commented 3 years ago

I added the ability to give nicknames to different ports. This is simmiliar to #32, but I think my version has several improvements.

First it is based upon current master. Second it remains backwards compatible with the old sinkname format. The format for both a sinkname and a portname is sinkname/portname. If a portname is specified, this rule takes precedence over rules with no portname specified. There is one downside of my implementation though: the sed command uses syntax, which is only available in the GNU version of sed. (At least this is what it says in the manpage.) I don't know how big of an issue this is for you. I also couldn't really find a solution that uses less commands, but maybe an awk script would be good here, but I don't really know much awk.

I also haven't added any documentation for that yet, but that should not be a problem.

SPFabGerman commented 3 years ago

Yeah, there should have been a $1. I originally had this code in the getCurSink function and later moved it to getSinkName because I think it makes more sense there. And I didn't noticed the inconsistency when I copy-pasted the code. Haha. So yeah, that is fixed now.

I also don't know what the better solution for getting the port name is. Yours looks like it is a bit more portable than mine, but I don't really know. But, yeah, maybe I was a bit to focused on creating a one-liner solution to getting the current port name.

marioortizmanero commented 3 years ago

No problem, thanks again for the PR. Merging this!