For systemd users there is a setting in /etc/systemd/logind.conf:
HandleLidSwitch
If you put HandleLidSwitch=ignore it will disable the switch.
You will need to restart systemd-logind daemon.
$ sudo service systemd-logind restart
For more low level, kernel solution: (found here: How to ignore lid switch action? and here: how to completely disable laptop lid detection? )
find node for the lid:
# grep LID /proc/acpi/wakeup LID S3 *enabled platform:PNP0C0D:00
The node is PNP0C0D:00 here. Write it to /sys/bus/acpi/drivers/button/unbind
like that:
# grep LID /proc/acpi/wakeup | sed -e 's/^.*platform://' > /sys/bus/acpi/drivers/button/unbind
For permanent effect you can put it in /etc/rc.local or /etc/rc5.d wherever your startup scrips are. 5 in rc5.d is your desired runlevel you use; can be found out with $ who -r)
Important note: Test this one first as for me it disabled suspending when I close lid - that is fine, but it still turns off screen and to get it back I needed to press Ctrl+Alt+F1 to get to terminal and run pm-suspend and then unsuspend it with home button. But I hope it will work for you.