bitbar plugin for toggling between mono and stereo audio
This file contains 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 | |
if [[ "$1" = "toggle" ]]; then | |
osascript -l JavaScript<<'END' | |
const appSE = Application("System Events"); | |
const appPrefs = Application("System Preferences"); | |
appPrefs.activate(); | |
appPrefs.panes.byId("com.apple.preference.universalaccess") | |
.anchors.byName("Hearing").reveal(); | |
const box = appSE.applicationProcesses.byName("System Preferences") | |
.windows.byName("Accessibility") | |
.groups.at(0) | |
.checkboxes.byName("Play stereo audio as mono"); | |
appSE.click(box); | |
appPrefs.preferencesWindow.close(); | |
END | |
fi | |
function runbitbar(){ | |
echo "⌁|bash=$0 param1=toggle terminal=false" | |
} | |
runbitbar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
New version uses JXA (Javascript for automation) over AppleScript, and has a bit more specificity, rather than assuming the locations of window elements