vi /etc/systemd/logind.conf
HandleLidSwitch
lock
systemctl restart systemd-logind
HandleLidSwitch=lock systemctl restart systemd-logind