Skip to content

Instantly share code, notes, and snippets.

@step21
Forked from NeoTheFox/autogpuswitch.sh
Created September 14, 2016 15:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save step21/d5139293e16336a48ebd60877b39be82 to your computer and use it in GitHub Desktop.
Save step21/d5139293e16336a48ebd60877b39be82 to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
echo "Checking the bus for any Nvidia cards.."
if lspci | grep NVIDIA
then
echo "Nvidia GPU detected!"
echo "Switching to Nvidia..."
if pacman -Qe | grep mesa-libgl
then
yes | pacman -S nvidia-libgl lib32-nvidia-libgl
fi
ln -sf /etc/X11/xorg.conf.nvidia /etc/X11/xorg.conf
else
echo "No Nvidia GPU detected"
echo "Switching to Mesa.."
if pacman -Qe | grep nvidia-libgl
then
yes | pacman -S mesa-libgl lib32-mesa-libgl
fi
rm /etc/X11/xorg.conf
fi
echo "Switched"
#sudo systemctl restart lightdm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment