How to disable auto suspend when I close laptop lid?

Edit /etc/systemd/logind.conf and make sure you have

HandleLidSwitch=ignore

which will make it ignore the lid being closed. (You may need to also undo the other changes you've made.)

Then, you'll want to reload logind.conf to make your changes go into effect (thanks to Ehtesh Choudhury for pointing this out in the comments):

systemctl restart systemd-logind

Full details over at the archlinux Wiki.

The man page for logind.conf also has the relevant information,

HandlePowerKey=, HandleSuspendKey=, HandleHibernateKey=, HandleLidSwitch=

    Controls whether logind shall handle the system power and sleep keys and the lid switch to trigger actions such as system power-off or suspend. Can be one of "ignore", "poweroff", "reboot", "halt", "kexec", "suspend", "hibernate", "hybrid-sleep" and "lock". If "ignore", logind will never handle these keys. If "lock", all running sessions will be screen-locked; otherwise, the specified action will be taken in the respective event. Only input devices with the "power-switch" udev tag will be watched for key/lid switch events. HandlePowerKey= defaults to "poweroff". HandleSuspendKey= and HandleLidSwitch= default to "suspend". HandleHibernateKey= defaults to "hibernate".


You can use this to temporarily disable lid-switch events:

systemd-inhibit --what=handle-lid-switch sleep 1d