Skip to content

Instantly share code, notes, and snippets.

@nielsvanvelzen
Last active August 13, 2017 10:16
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 nielsvanvelzen/2a10c45aebdc7a192533529dc6da99f4 to your computer and use it in GitHub Desktop.
Save nielsvanvelzen/2a10c45aebdc7a192533529dc6da99f4 to your computer and use it in GitHub Desktop.
Toggle prime on gnome
CURRENT_DRIVER=$(prime-select query)
NEW_DRIVER="intel"
if [ "$CURRENT_DRIVER" = "intel" ]; then
NEW_DRIVER="nvidia"
fi
pkexec prime-select "$NEW_DRIVER" > /dev/null
echo "Switched from $CURRENT_DRIVER to $NEW_DRIVER"
notify-send "GPU switched" "Switched to $NEW_DRIVER from $CURRENT_DRIVER" --icon=video-display
sync
gnome-session-quit --logout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment