Skip to content

Instantly share code, notes, and snippets.

@patricksamson
Forked from soldni/gpu.applescript
Last active August 29, 2015 14:26
Show Gist options
  • Save patricksamson/dfaf62a8b69b70877336 to your computer and use it in GitHub Desktop.
Save patricksamson/dfaf62a8b69b70877336 to your computer and use it in GitHub Desktop.
Toggle between "discrete GPU only" and "automatic switching" on a 15" Retina MacBook Pro.
tell application "System Preferences"
reveal pane "com.apple.preference.energysaver"
end tell
tell application "System Events" to tell process "System Preferences" to tell window "Energy Saver"
set status to value of checkbox "Automatic graphics switching" of group 1
click checkbox "Automatic graphics switching" of group 1
end tell
quit application "System Preferences"
if status is 0 then
return "Automatic switch activated"
else
return "Discrete graphics only"
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment