Skip to content

Commit

Permalink
Add GPUEjectPolicy
Browse files Browse the repository at this point in the history
  • Loading branch information
mayankk2308 committed Jan 4, 2019
1 parent c71a001 commit 7c36492
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions set-eGPU.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ MACOS_BUILD="$(sw_vers -buildVersion)"
# GPU Policy
GPU_SELECTION_POLICY_KEY="GPUSelectionPolicy"
GPU_SELECTION_POLICY_VALUE="preferRemovable"
GPU_EJECT_POLICY_KEY="GPUEjectPolicy"
GPU_EJECT_POLICY_VALUE="relaunch"

# PlistBuddy
PlistBuddy="/usr/libexec/PlistBuddy"
Expand Down Expand Up @@ -219,6 +221,7 @@ set_app_pref() {
APP_PLIST="${FULL_APP_PATH}/Contents/Info.plist"
BUNDLE_ID="$($PlistBuddy -c "Print :CFBundleIdentifier" "${APP_PLIST}")"
defaults write "${BUNDLE_ID}" "${GPU_SELECTION_POLICY_KEY}" "${GPU_SELECTION_POLICY_VALUE}" 1>/dev/null 2>&1
defaults write "${BUNDLE_ID}" "${GPU_EJECT_POLICY_KEY}" "${GPU_EJECT_POLICY_VALUE}" 1>/dev/null 2>&1
return
fi
toggle_gpu_pref "${FULL_APP_PATH}" false
Expand All @@ -232,6 +235,7 @@ reset_app_pref() {
APP_PLIST="${FULL_APP_PATH}/Contents/Info.plist"
BUNDLE_ID="$($PlistBuddy -c "Print :CFBundleIdentifier" "${APP_PLIST}")"
defaults delete "${BUNDLE_ID}" "${GPU_SELECTION_POLICY_KEY}" 1>/dev/null 2>&1
defaults delete "${BUNDLE_ID}" "${GPU_EJECT_POLICY_KEY}" 1>/dev/null 2>&1
return
fi
toggle_gpu_pref "${FULL_APP_PATH}" true
Expand Down

0 comments on commit 7c36492

Please sign in to comment.