Hello,
I hope I'm at the right address with this issue here, but I was wondering if the 'audio output device changes' trigger is working for other people?
I'm trying to write a simple macro using that trigger and an applescript that starts a specific application based on which output is active, but it seems that KM doesn't trigger when said change happens... I tried to confirm it's the trigger that is the issue, not my script, by having just a keyboard maestro alert pop-up as soon as the trigger is fired, but this also never shows (nor does it register in the debugging screen), even if I switch the output source manually in the system preferences.
I'm running a MacBook Pro 2018 with Mojave 10.14.2 and wondering if others can reproduce this issue or if it's just me?
What devices are you changing from/to? Mainly it currently just detects changing the data source (ie, from headphones to internal speakers). I have enhanced it for the next version to detect more devices/changes.
1 Like
Hi,
That's actually exactly what I was trying to do (speakers to headphone and back). Whether it is by physically attaching/detaching my headphones the mini-jack or using a program like Rogue Amoeba's SoundSource, the change in output device just never seems to trigger KM.
Well, hopefully the enhancements will detect the change in the next version, if not let me know and I will take a look - the API for this stuff is arcane beyond comprehension.
1 Like
Would also love to make a macro with this feature working .
What kind of connection is it? Generally it will currently only work with the actual headphone selection. The next version of Keyboard Maestro may have more ability to detect changes.
When I plug my headphone in, the macro is executed.
1 Like
Can happily report that KM 9 now correctly triggers macros when the audio output changes on my 2018 Macbook pro! Worth the upgrade cost for that alone in my case
Great to hear - it's always a bit tricky with things like this where I have limited hardware to test it with.
@Timolution Any interest in sharing your Applescript? I'm trying to do the same exact thing. Can definitely handle googling my way through it, but if the working code is already available....
@jmayhugh I would definitely do so were it not for the fact that I abandoned the AppleScript idea half-way through and just relied on KM's capability to start/stop apps in combination with calling shell arguments to do what I wanted to do.
The idea is that when the audio output changes to headphones a certain application is started while the system sound effects output is also switched over to the new output automatically, and when the output changes to another source the application is terminated while the SSE output also switches over.
Basically when the audio output trigger fires I store the output device in a variable, which I then check in an if-statement, and when this reads 'External Headphones' I launch the desired application if it is not already running, and run a shell argument** to also change the sound effect output over. And vice versa when the audio input changes to something else than external headphones.
Don't know if that helps you in any way though?
Audio output change (simple).kmmacros (18.7 KB)
** Made possible thanks to the handy switch audio-osx Brew formula.