#!/bin/sh # Some distro requires that the absolute path is given when invoking lspci # e.g. /sbin/lspci if the user is not root. gpu=$(lspci | grep -i '.* VGA .* .*') shopt -s nocasematch if [[ $gpu == *' NVIDIA '* ]]; then cat << EOF > /etc/X11/xorg.conf.d/20-nvidia.conf Section "Device" Identifier "NVIDIA" Driver "nouveau" Option "DRI" "3" Option "TearFree" "true" EndSection EOF if [ -f /var/log/packages/xf86-video-nouveau-blacklist-1.0-noarch-1 ]; then spkg -d xf86-video-nouveau-blacklist modprobe nouveau fi elif [[ $gpu == *' AMD '* ]]; then cat << EOF > /etc/X11/xorg.conf.d/20-amdgpu.conf Section "Device" Identifier "AMD" Driver "amdgpu" Option "TearFree" "true" EndSection EOF elif [[ $gpu == *' Intel '* ]]; then cat << EOF > /etc/X11/xorg.conf.d/20-intel.conf Section "Device" Identifier "Intel Graphics" Driver "intel" Option "Backlight" "intel_backlight" EndSection EOF elif [[ $gpu == *' Radeon '* ]]; then cat << EOF > /etc/X11/xorg.conf.d/20-radeon.conf Section "Device" Identifier "Radeon" Driver "radeon" Option "DRI" "3" Option "TearFree" "true" EndSection EOF elif [[ $gpu == *' ATI '* ]]; then cat << EOF > /etc/X11/xorg.conf.d/20-ati.conf Section "Device" Identifier "Radeon" Driver "ati" Option "DRI" "3" Option "TearFree" "true" EndSection EOF fi