How to fix the sleep/suspend Issue/glitch with crashing Nvidia propietary drivers and X11 / Wayland on KDE Plasma, EndeavourOS/ Plasma

Here is the fix: run following three commands in your terminal:

sudo systemctl enable nvidia-suspend.service

sudo systemctl enable nvidia-hibernate.service

sudo systemctl enable nvidia-resume.service

then: cd /lib/modprobe.d

sudo nano systemd.conf

Add following line at the end of the file:

options nvidia NVreg_PreserveVideoMemoryAllocations=1

CTRL-X and save

Then update (rebuild) kernel boot images

When using default systemd-boot and dracut:

sudo reinstall-kernels

When using Grub and dracut:

sudo dracut-rebuild