Skip to content

Instantly share code, notes, and snippets.

@niccolomineo
Last active January 21, 2023 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niccolomineo/475ab56cf51288f8456998824251ca73 to your computer and use it in GitHub Desktop.
Save niccolomineo/475ab56cf51288f8456998824251ca73 to your computer and use it in GitHub Desktop.
Toggles Bluetooth on Mac Os. Requires blueutil utility.
on run {input, parameters}
tell application "System Events"
set current_status to (do shell script "eval $(/usr/libexec/path_helper -s); blueutil | grep 'Power:' | cut -c8-")
if current_status = "0" then
do shell script "eval $(/usr/libexec/path_helper -s); blueutil -p 1"
beep
delay 0.25
beep
else
do shell script "eval $(/usr/libexec/path_helper -s); blueutil -p 0"
end if
end tell
return input
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment