Skip to content

Instantly share code, notes, and snippets.

@tomichj
Last active August 29, 2015 14:02
Show Gist options
  • Save tomichj/87be3a823787831778ab to your computer and use it in GitHub Desktop.
Save tomichj/87be3a823787831778ab to your computer and use it in GitHub Desktop.
Mac OS X Keyboard Maestro script to toggle bluetooth on and off
# first install blueutil, 'brew install blueutil'
# next create a new Keyboard Maestro macro
# add a Execute Shell Action action to script and paste in the following:
bluetooth=$(/usr/local/bin/blueutil)
is_on="Power: 1"
if [[ "$bluetooth" =~ "$is_on" ]];
then
/usr/local/bin/blueutil power 0
else
/usr/local/bin/blueutil power 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment