alfred-workflows
alfred-workflows copied to clipboard
[Bug]: switch-audio does not on macOS 13 Ventura
Describe the bug
switch-audio workflow is no longer working on macOS 13 Ventura.
Behavior:
The sound
and voice
commands do not return the devices list.
MacOS Version
macOS 13 Ventura
Alfred Version
Alfred 5.0.5
Workflow Name
Switch Audio
- I haven't upgraded my new system at the moment, so I can't test verify the issue.
- The workflow relies on the UI, so the cause of the problem should be here.
I have adapted it locally to work with Mac OS Ventura. I am using switchaudio-osx
and jq
in order to select and switch the devices without relying on AppleScript and the System Settings.
Therefore, my solution is not an easy drop-in, but in case you are interested, my main.sh
looks like:
#!/bin/zsh
type=$1
current=$(SwitchAudioSource -c -t $type -f json)
current_id=$(echo $current | jq -r '.id')
current_extended=$(echo $current | jq -rc --arg TYPE "$type" '{title: .name, uid: .name, autocomplete: .name, arg: .id, icon: {path: ("./icons/"+ $TYPE + "_selected.png")}}')
all_without_current=$(SwitchAudioSource -a -t $type -f json | jq -rc --arg CURRENT "$current_id" 'select(.id != $CURRENT) | {title: .name, uid: .name, autocomplete: .name, arg: .id}')
echo "$all_without_current\n$current_extended" | jq -r --slurp 'sort_by(.title) | {items: .}'
can be called via ZSH ./main.sh output
(or input
)
Preconditions can be installed via
brew install switchaudio-osx jq
The actual command for switching then is a ZSH script as well
SwitchAudioSource -i $1 > /dev/null
SwitchAudioSource -c
If that is a path you consider going with the plugin, I am happy to provide a PR.
Seeing the same issue on my end. (I didn't attempt Tobias' fix)
MacOS Ventura 13.0.1 - Alfred version 5.0.6
Here is the error:
[10:39:59.050] Switch Audio[Script Filter] Queuing argument '(null)' [10:39:59.193] Switch Audio[Script Filter] Script with argv '(null)' finished [10:39:59.193] ERROR: Switch Audio[Script Filter] Code 1: /Users/chris/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/A80F00C9-3FBC-481F-B5CB-A94ED3E5EB49:55:102: execution error: System Settings got an error: AppleEvent handler failed. (-10000)
+1 @am-chris
Ventura 13.1, Alfred 5.0.6
my "log" :
[21:19:28.232] Logging Started...
[21:19:30.727] Switch Audio[Script Filter] Queuing argument '(null)'
[21:19:30.913] Switch Audio[Script Filter] Script with argv '(null)' finished
[21:19:30.918] ERROR: Switch Audio[Script Filter] Code 1: /Users/alexbnd/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/FBE66A11-B1A0-40C9-8F30-87C699126DF7:55:102: execution error: System Settings got an error: AppleEvent handler failed. (-10000)
@TobiasMende You are nice.
switchaudio-osx does not support airplay devices. so I think AppleScript it's better.
You are right. Did not use AirPlay, so I was not aware of this limitation.
Found this issue, where you already commented: https://github.com/deweller/switchaudio-osx/issues/9
Unfortunately, there also seems to be no working AppleScript solution for Ventura yet. Do you know one?
@TobiasMende
I will update my home mac to Ventura and have a try.
@alanhg
Hope to help fix the bug: https://forum.keyboardmaestro.com/t/macro-set-sound-output-v4-0/23959
I like Alfred rather than Keyboard Maestro.
@alanhg looking forward to use your workflow at ventura!
AppleScript documentation was so poor that I had to consider learning Swift to solve it.
any updates? this was one of my most used workflows up until Ventura.
I found some sources online and got this AppleScript to work in Ventura: https://github.com/deweller/switchaudio-osx/issues/9#issuecomment-1496674289
(Caveat: doesn't seem to work when System Settings is launched hidden or in the background, so if someone knows how to fix that, it would be most welcome.)
any updates? this was one of my most used workflows up until Ventura.
In development.
I gave up on using AppleScript and decided to do secondary development based on switchaudio-osx.
list airplay device is ok. but switch to airplay not work. I need to find method to do it.
hey, don't shoot me pls :) just wandering if this something that you still think about. thank you!
+1
+1
@alanhg Hope to help fix the bug: https://github.com/lapfelix/BluetoothConnector 1、install bluetoothconnector by homebrew: brew install bluetoothconnector
2、bluetoothconnector with the MAC address of specific device eg: myAirPods MAC address: 30-82-16-f2-a4-e1
3、make Application by Automator
the shell script: #!/bin/sh /usr/local/bin/BluetoothConnector --connect 30-82-16-f2-a4-e1 --notify << EOF 123 EOF
4、allow your application to use bluetooth
5、open your application with alfred or spotlight just enjoy it!
I found DNSService can list airplay device. but I have not found any method to set airplay device as sound-output