Skip to content

Instantly share code, notes, and snippets.

@Fusion
Created October 3, 2021 06:57
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 Fusion/9d666f49e5dd1a140c2916efd29cfa3d to your computer and use it in GitHub Desktop.
Save Fusion/9d666f49e5dd1a140c2916efd29cfa3d to your computer and use it in GitHub Desktop.
Cycling Bluetooth off and off: workaround for capricious keyboard on Mac M1
tell application "System Preferences"
reveal pane id "com.apple.preferences.Bluetooth"
activate
tell application "System Events" to tell process "System Preferences"
display notification "Turning Bluetooth off and then back on." with title "Bluetooth" subtitle "Hopefully this fixes any keyboard issue." sound name "Frog"
click button "Turn Bluetooth Off" of window "Bluetooth" of application process "System Preferences" of application "System Events"
delay 5
click button "Turn Bluetooth On" of window "Bluetooth" of application process "System Preferences" of application "System Events"
end tell
quit
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment