Properly unload NVIDIA modules when using Intel

This commit is contained in:
r4 2021-05-31 11:52:58 +02:00
parent 8eee021aad
commit a4e512b547

View File

@ -43,6 +43,8 @@ case $1 in
echo "Backed up existing XOrg config file /etc/X11/xorg.conf to /etc/X11/xorg.conf.nvidia"
echo " " > ~/.local/lib/nvidia-switch-rc.sh
su_run "sed -i '/^nvidia$/d' /etc/modules-load.d/video.conf"
echo "Switched to Intel GPU"
;;
n|nvidia)
@ -53,10 +55,10 @@ case $1 in
echo -e "xrandr --setprovideroutputsource modesetting NVIDIA-0\nxrandr --auto" > ~/.local/lib/nvidia-switch-rc.sh
su_run "mkdir -p /etc/modules-load.d"
su_run "echo nvidia > /etc/modules-load.d/video.conf"
grep '^nvidia$' /etc/modules-load.d/video.conf > /dev/null || su_run "echo nvidia >> /etc/modules-load.d/video.conf"
echo "Switched to NVIDIA GPU. You will probably need to restart."
;;
*) usage; exit 1
;;
esac
esac