prenagha / launchbar

LaunchBar Actions
https://renaghan.com/launchbar/
Apache License 2.0
182 stars 13 forks source link

Outputs list truncates trailing spaces #13

Closed jwhitley closed 4 years ago

jwhitley commented 4 years ago

tl;dr: it appears that macOS may allow trailing spaces in audio device names. 🤦‍♂ These are inadvertently stripped in this action, breaking the ability to select these ill-named devices.

Example:

>> bash ./audio.sh
{
  "currentInput": "MacBook Pro Microphone",
  "currentOutput": "USB Sound Device        ",
  "inputs": [ "CalDigit Thunderbolt 3 Audio", "LG UltraFine Display Audio", "MacBook Pro Microphone" ],
  "outputs": [ "USB Sound Device", "CalDigit Thunderbolt 3 Audio", "LG UltraFine Display Audio", "MacBook Pro Speakers" ]
}

Note that currentOutput has the correct string with trailing spaces, but that item in outputs does not. The actual device is a Matrix Audio USB audio interface, which IIRC should just be using the USB audio class driver. System Information also clearly shows the trailing spaces in its audio device list:

USB Sound Device        :

where no other device has spaces between the name and the colon, e.g.:

MacBook Pro Speakers: