From a4e512b547c47a8b381005c6065728f4151ab893 Mon Sep 17 00:00:00 2001 From: r4 Date: Mon, 31 May 2021 11:52:58 +0200 Subject: [PATCH] Properly unload NVIDIA modules when using Intel --- opti-sw.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/opti-sw.sh b/opti-sw.sh index ca29b9f..e46d499 100644 --- a/opti-sw.sh +++ b/opti-sw.sh @@ -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 \ No newline at end of file