Skip to content

Instantly share code, notes, and snippets.

@stephonchen
Created January 9, 2018 08:09
Show Gist options
  • Save stephonchen/fca7605ac82d5267a638d4d604b70255 to your computer and use it in GitHub Desktop.
Save stephonchen/fca7605ac82d5267a638d4d604b70255 to your computer and use it in GitHub Desktop.
Reset sound balance through CLI, using OSAScript
#!/usr/bin/osascript
(* Set Volume to 100 *)
set volume 100
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.sound"
reveal (first anchor of current pane whose name is "output")
end tell
tell application "System Events"
launch
(* Set sound balance to 0.5 (center), 0 -> left, 1 -> right *)
tell process "System Preferences" to tell slider 1 of group 1 of tab group 1 of window 1 to set value to 0.5
end tell
quit application "System Preferences"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment