This question already has an answer here:
I tried Ubuntu 18.04, Budgie, and both have the same probelm when using nvidia dirver 390 & 396. When resume from suspend the system logout and every program I was working on is closed.
It seems that nvidia driver is not supporting any change I make on xorg.
When switch back to nouveau, the system works normally, and suspend resume is not logging out.
I have almost every solution on the web, including nvidia forum and SE, none of them works.
I reset recursively
dconf-editor and now it works probably till now, it seems to be a gnome-shell problem
This problem is not a swap error, since I tried to turnoff the swap, in addition, I read the journal output, I is related to gnome-shell dealing with nvidia leads to kill the session when turning on the screen, or waking from sleep.
note: I know this question may be duplicated but for some reason I can't post any answer or put any comment.
Please Please If you realy know the answer share it otherwise don't comment any off topic comment