Skip to content

Instantly share code, notes, and snippets.

@bericp1
Created January 22, 2019 20:48
Show Gist options
  • Save bericp1/7c7fbb9a602fd3648c0dc965a0af4447 to your computer and use it in GitHub Desktop.
Save bericp1/7c7fbb9a602fd3648c0dc965a0af4447 to your computer and use it in GitHub Desktop.
Bash-wrapped AppleScript to toggle the "built-in trackpad disabled" accessibility setting.
# Built-in Trackpad toggle script
# https://github.com/Ryderpro/Apple-Scripts
osascript <<'END'
tell application "System Preferences"
quit
delay 1
end tell
tell application "System Preferences"
reveal anchor "Mouse" of pane id "com.apple.preference.universalaccess"
activate
end tell
set checkboxNumber to 3
tell application "System Events" to tell process "System Preferences"
repeat while not (exists of checkbox checkboxNumber of group 1 of window "Accessibility")
delay 0.1
end repeat
set theCheckbox to checkbox checkboxNumber of group 1 of window "Accessibility"
tell theCheckbox
# If the checkbox is not checked, check it to turn grayscale on
if not (its value as boolean) then
set checked to true
click theCheckbox
else # else turn grayscale off
set checked to false
click theCheckbox
end if
end tell
end tell
tell application "System Preferences"
quit
end tell
if checked = true then
display notification "Ignoring built-in trackpad while mouse or wireless trackpad is present."
else
display notification "Built-in trackpad is now active."
end if
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment