https://blog.csdn.net/u012090807/article/details/100077280
stackoverflow的回答:https://askubuntu.com/questions/1062369/how-to-disable-auto-sleep-in-ubuntu-18-04
I finally found a solution looking through some other threads. Here’s what I did:
Install gnome-tweak-tool: sudo apt install gnome-tweak-tool
Run gnome-tweaks.( 这个会进入修改界面。)
Change the option under “Power” for “Suspend when laptop lid is closed” to “off”.
Now the monitor only turns off the screen when the lid is closed, and no longer goes to sleep.
This doesn’t really resolve the issue of sleep-looping in case I ever wanted the laptop to actually go to sleep, but it’s a good enough solution for me at least.