brew install switchaudio-osx- Check your audio devices with
switchaudiosource -a - Replace
Mac mini LautsprecherandExterne Kopfhörerwith your ouput channels - Place the script somewhere your user can execute it (do a
chmod +x audiotoggle.sh) - Copy the json and paste it to BTT. Edit the script path and you're done.
Last active
January 18, 2022 11:58
-
-
Save CodeBrauer/e33689216f5ae7fcad20b07ad62fa7cd to your computer and use it in GitHub Desktop.
quick and dirty script to toggle audio device (switch between speaker and headphones) using switchaudio-osx and BetterTouchTool (for a keyboard shortcut)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # /usr/local/bin/switchaudiosource -a | |
| CURRENT=$(/usr/local/bin/switchaudiosource -c) | |
| echo $CURRENT; | |
| if [[ "$CURRENT" == "Externe Kopfhörer" ]]; then | |
| /usr/local/bin/switchaudiosource -s "Mac mini Lautsprecher" | |
| /usr/bin/osascript -e 'display notification "Mac mini Lautsprecher" with title "Audioausgang geändert"' | |
| else | |
| /usr/local/bin/switchaudiosource -s "Externe Kopfhörer" | |
| /usr/bin/osascript -e 'display notification "Externe Kopfhörer" with title "Audioausgang geändert"' | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut", | |
| "BTTPredefinedActionType" : 172, | |
| "BTTPredefinedActionName" : "Apple Script starten (blockierend)", | |
| "BTTInlineAppleScript" : "do shell script \"\/Users\/codebrauer\/scripts\/audiotoggle.sh\"", | |
| "BTTAdditionalConfiguration" : "8519680", | |
| "BTTEnabled2" : 1, | |
| "BTTKeyboardShortcutKeyboardType" : 3253, | |
| "BTTRepeatDelay" : 0, | |
| "BTTUUID" : "E86A6EE6-0B34-4607-8D94-9AE303AF29CB", | |
| "BTTTriggerOnDown" : 1, | |
| "BTTNotesInsteadOfDescription" : 0, | |
| "BTTLayoutIndependentChar" : "F12", | |
| "BTTEnabled" : 1, | |
| "BTTModifierMode" : 0, | |
| "BTTShortcutKeyCode" : 111, | |
| "BTTShortcutModifierKeys" : 8519680, | |
| "BTTOrder" : 5, | |
| "BTTDisplayOrder" : 0, | |
| "BTTAutoAdaptToKeyboardLayout" : 0 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated version: https://gist.github.com/CodeBrauer/dab920d92dfb703facda6a3a4be0300d