One-Click Audio Input/Output Device Switching on Mac with Alfred

This article introduces implementing one-click audio input/output device switching on Mac with Alfred, including advantages, implementation details, and related resources to improve efficiency.

Dec 6, 2020 · 1 min read · 159 Words · -Views -Comments · Software & Tools
Mac Productivity Tools 🇨🇳 阅读中文版
Read with AI

Choose an AI assistant

ChatGPT Open in a new tab with the article link and prompt
Claude Copy the prompt, then open Claude

Open Claude
Trouble reading the article?

If the prompt is missing, copy the full prompt below into your AI assistant. If the AI cannot read the article, paste the visible passage you want to discuss and add your question.

With an increasing number of peripherals in the Mac ecosystem, there’s a frequent need to switch audio input and output devices. GUI operations are too inefficient, so I spent my weekend creating a workflow to improve switching efficiency.

Implementation Foundation

After researching various solutions, I found the options were limited:

  • There’s a command-line module called switchaudio-osx, but it doesn’t support AirPlay, and the author has no plans to add support. Modifying it would require C language development skills, so I abandoned this approach
  • AppleScript+Shell has the advantage of being built into the Mac environment with no dependencies, allowing for direct installation and use

I ultimately chose option 2, which required me to systematically learn AppleScript. I managed to get it working after just a few hours.

Current Effect

Download link: Click here

Conclusion

One hallmark of programmer efficiency is keeping your hands on the keyboard. With this workflow’s support, switching audio devices no longer requires using the mouse. Nice!

Authors
Developer, digital product enthusiast, tinkerer, sharer, open source lover