Closed foben closed 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 :)
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?
alright, so I removed the "intermediate fallback" of device.description property.
So now the script does a map lookup and returns Sink
Great! Thanks for the help.
Two thoughts to consider & discuss (not necessarily implement):
What if the map's name was something like NICKNAMES
or DISPLAY_NAMES
, rather than NAME_DISPLAYNAME_MAP
? It's shorter and less confusing IMO.
What if it was "Sink #0" rather than "Sink 0"?
I like both, so I updated accordingly :)
Okay, I'm merging this and I'll make a couple changes too. Thanks for the PR again!
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.