Skip to content

Instantly share code, notes, and snippets.

@soldni
Created October 25, 2014 01:51
Show Gist options
  • Save soldni/6d582f97cc6b6d8ea505 to your computer and use it in GitHub Desktop.
Save soldni/6d582f97cc6b6d8ea505 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