Jump to content

Bluetooth Toggle

Recommended Posts

Does just what it says on the tin: toggles Bluetooth on or off depending on the current state. It's built to work with OS X Yosemite and Yosemite alone.


To use, just type bt and press enter. If Bluetooth is on, it will be turned off. If Bluetooth is off, it will be turned on.

The original AppleScript was written by fartheraway in response to a question on StackExchange. I just packaged it and gave it a simple icon that will work equally well on dark and light themes.
Known shortcomings:
- Current state (on or off) not shown
- New state not shown/notified
Edited by cubb

Share this post

Link to post

Very handy script, but it stopped working for me with Mac OSX Mojave.


I found this alternative AppleScript which seemed to do the trick - just replaced the Run NSAppleScript section of the workflow and it works now:


on alfred_script(q)
	tell application "System Preferences"
	reveal pane id "com.apple.preferences.Bluetooth"
	-- activate
	set the current pane to pane id "com.apple.preferences.Bluetooth"
		tell application "System Events" to tell process "System Preferences"
			click button "Turn Bluetooth Off" of window "Bluetooth"
			click button "Turn Bluetooth Off" of sheet 1 of window "Bluetooth" of application process "System Preferences" of application "System Events"
		end tell
		delay 1
	on error
		tell application "System Events" to tell process "System Preferences"
			click button "Turn Bluetooth On" of window "Bluetooth"
		end tell
	end try
end tell
end alfred_script


Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...