Run laptop with the lid closed
Published on
Edit the /etc/systemd/logind.conf
file, and change the following lines:
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
Then restart the service:
sudo systemctl restart systemd-logind.service