sudo -H gedit /etc/systemd/logind.conf
HandleLidSwitch=ignore
sudo service systemd-logind restart
# Still sleep after idle
sudoedit /etc/UPower/UPower.conf
Change IgnoreLid to IgnoreLid=true
service upower restart
# also in /etc/systemd/logind.conf
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
HandleHibernateKey=ignore
HandleSuspendKey=ignore
IdleAction=ignore
IdleActionSec=0
# Still sleep after idle
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target