deweller/switchaudio-osx

Toggle Switch

becauseim opened this issue · 8 comments

I have two quick actions to turn on separate devices, but I would like to have one action to switch between the two devices. how do I do this?

Снимок экрана 2021-03-20 в 20 06 11

I use something like [ "$(AudioSwitcher -c)" = "Built-in Output" ] && AudioSwitcher -s "DisplayPort" || AudioSwitcher -s "Built-in Output"

I use something like [ "$(AudioSwitcher -c)" = "Built-in Output" ] && AudioSwitcher -s "DisplayPort" || AudioSwitcher -s "Built-in Output"

Thank you! But i don't understand how to use it. My example is based on this one

It's just the Shell Script, like the one you already have. E.g. replace

/usr/local/bin/SwitchAudioSource -t output -s 'Cayin N3Pro'

with

[ "$(/usr/local/bin/SwitchAudioSource -c)" = "Built-in Output" ] && /usr/local/bin/SwitchAudioSource -s "Cayin N3Pro" || /usr/local/bin/SwitchAudioSource -s "Built-in Output"

or, simpler, maybe just use

/usr/local/bin/SwitchAudioSource -n

which will switch to each next audio output available (A -> B -> ... -> A).

Thank you! Unfortunately, an error comes out when calling a quick action.

Снимок экрана 2021-03-20 в 23 39 35

/usr/local/bin/SwitchAudioSource -n

this option is not suitable because you need to switch between two devices out of three (without built-in macbook speakers)

my goal is to switch between two external output devices with one keyboard shortcut

Try in Terminal.app to see what's wrong.

Closing this because it is not an issue directly related to switchaudio-osx.

I hope you are able to resolve your problem with your bash script.

If anybody lands here, I wrote this bash script to toggle between 2 audio interfaces with Alfred.

https://gist.github.com/gianpaj/6334e6a4cd1f9fe48b58c1e7b8ccd5a2

Though this Alfred Workflow is readily done and works great :)
https://github.com/dkarter/alfred-switch-audio