TrevorS/aswitch

★ 1Forks 0SwiftGitHub ↗Compare

README

░█▀█░█▀▀░█░░░█░▀█▀░▀█▀░█▀▀░█░█
░█▀█░▀▀█░█▄█▄█░░█░░░█░░█░░░█▀█
░▀░▀░▀▀▀░▀░▀░▀░▀▀▀░░▀░░▀▀▀░▀░▀

macOS audio output device switcher. Uses CoreAudio directly — no dependencies.

Install

make install                      # installs to ~/.local/bin/aswitch
make install PREFIX=/usr/local    # or system-wide

Ensure ~/.local/bin is in your PATH.

Usage

aswitch                       # list output devices
aswitch list --json           # list as JSON
aswitch get                   # current default device
aswitch get --json            # current default as JSON
aswitch set 2                 # switch by index
aswitch set airpods           # switch by name (case-insensitive)
aswitch set <uid>             # switch by CoreAudio UID
aswitch set --json airpods    # switch with JSON confirmation

All --json output uses a consistent {index, name, uid, default} shape.

Errors go to stderr with non-zero exit.

Development

make              # show help
make build        # build
make test         # run tests
make validate     # format + lint + build + test
make run ARGS='list --json'

Requires swift-format and swiftlint (brew install swift-format swiftlint).

Contributors

TrevorS

Issues