Skip to content

Instantly share code, notes, and snippets.

@NeoTheFox
Last active April 13, 2020 07:44
Show Gist options
  • Save NeoTheFox/f42c3ef6dd0c22edcc35 to your computer and use it in GitHub Desktop.
Save NeoTheFox/f42c3ef6dd0c22edcc35 to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# You would have to create an xorg.conf file for your Nvidia setup #
# before using this script! It can be done by running: #
# #
# nvidia-xconfig -o /etc/X11/xorg.conf.nvidia #
# #
# Make sure your system has eGPU connected and a monitor plugged into the GPU. #
# The reason I've never automated this is that you have to have it all plugged #
# in and ready to go. Also some may prefer writing xorg.conf.nvidia by hand. #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
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
@NeoTheFox
Copy link
Author

Since I've been using a lot of things changed, in particular now we have a libglvnd that allows us to have more than 1 libgl on our systems at once. So the dirty hack with uninstalling/installing the libgl is no longer needed, and I don't know what else is broken here.

@terabyte25
Copy link

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment