Skip to content

Instantly share code, notes, and snippets.

@charandas
Created July 20, 2016 23:28
Show Gist options
  • Save charandas/e4f7d482865336747befb0b8194422c8 to your computer and use it in GitHub Desktop.
Save charandas/e4f7d482865336747befb0b8194422c8 to your computer and use it in GitHub Desktop.
Level control haunted OS X input slider
## The script for our case came down to this:
while true ; do
CURR_LEVEL=$(osascript -e "input volume of (get volume settings)")
echo "Setting at : ${CURR_LEVEL}";
while (( $CURR_LEVEL < 50 )); do
TARGET_LEVEL=$(($CURR_LEVEL + 3));
echo "Setting to : ${TARGET_LEVEL}";
osascript -e 'display notification "Setting to: '"$TARGET_LEVEL"'" with title "My Mic App"'
osascript -e "set volume input volume ${TARGET_LEVEL}";
sleep 0.01;
CURR_LEVEL=$(osascript -e "input volume of (get volume settings)");
done;
sleep 1;
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment