Skip to content

Instantly share code, notes, and snippets.

@parties
Last active August 23, 2021 18:36
Show Gist options
  • Save parties/dce39e69f79eded1aa9c4ab90db1d3c1 to your computer and use it in GitHub Desktop.
Save parties/dce39e69f79eded1aa9c4ab90db1d3c1 to your computer and use it in GitHub Desktop.
Quicksilver + blueutil script for easily toggling bluetooth power
-- Requirements:
-- blueutil v2.9.0+ (brew install blueutil); may work with earlier versions, haven't tested
-- save this under ~/Library/Scripts and refresh your user scripts in Quicksilver for this to appear
-- you can create a trigger to run this script on a keyboard shortcut, such as: ⌘⌥^ + B
-- save local path to blueutil executable
set blueutil to "/usr/local/bin/blueutil"
-- get current power status and save it to variable
set statusResult to do shell script blueutil & " -p"
-- toggle power status
if statusResult is "1" then
do shell script blueutil & " -p 0"
else if statusResult is "0" then
do shell script blueutil & " -p 1"
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment