saving a X config file for nvidia setting disables my PRIME internal display

Solution 1:

You may try this solution, which seems to have worked for others.

  1. Remove any xorg.conf in /etc/X11

  2. Create directory /etc/X11/xorg.conf.d

  3. Create file /etc/X11/xorg.conf.d/20-nvidia-antitear.conf with contents

     Section "OutputClass"
         Identifier "nvidia-antitear"
         MatchDriver "nvidia-drm"
         Driver "nvidia"
         Option "ForceCompositionPipeline" "true"
     EndSection
    

Related: https://wiki.archlinux.org/title/NVIDIA/Troubleshooting#Avoid_screen_tearing


Alternatively, you could write a script that applies the settings as mentioned by adi, but run it at boot time via crontab so it works for any user. This is done here.

The solution via compton posted there is yet another option.