marioortizmanero / polybar-pulseaudio-control

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

Human readable names #22

Closed foben closed 4 years ago

foben commented 4 years ago

I (mainly for myself) implemented the possibility to display a name for the current sink, as the indices change and I can't remember which is which :) The functionality either uses the "device.description" property as a fallback name or a name supplied from a lookup table that maps the pulseaudio sink name (which is expected to be stable) to a custom name.

Feel free to reject if this isn't the direction you'd like to go, but I thought I'd share my adjustments, maybe you're interested. I probably will implement something similar for the icon mapping, also based on the pulseaudio sink name instead of the index.

foben commented 4 years ago

I made the suggested changes and the linter is happy now :) I agree that bash maps are terrible. To keep it simple(r) I'd probably define a second map for the icons and map them the same way, again using the pulseaudio sink names as mapping keys. This is probably the most reliable way.

Regarding nicknames as defaults: :+1: Sure, I'd prefer that, but I didn't want to change the default behavior :)

marioortizmanero commented 4 years ago

Yes, I think it's better to leave it as a default option. By default, the sinks map should be empty (or with an example that will never exist). If there's an entry for the sink, it should be used. Otherwise, the number.

What do you think?

foben commented 4 years ago

alright, so I removed the "intermediate fallback" of device.description property. So now the script does a map lookup and returns Sink if none is found

marioortizmanero commented 4 years ago

Great! Thanks for the help.

Two thoughts to consider & discuss (not necessarily implement):

foben commented 4 years ago

I like both, so I updated accordingly :)

marioortizmanero commented 4 years ago

Okay, I'm merging this and I'll make a couple changes too. Thanks for the PR again!