Last active
August 29, 2015 14:02
-
-
Save tomichj/87be3a823787831778ab to your computer and use it in GitHub Desktop.
Mac OS X Keyboard Maestro script to toggle bluetooth on and off
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
# 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