HandleLidSwitch=ignore
does just that: it ignores lid behavior. So the screen will not turn off if you use this method.
The following answer is adapted from this source
You will need to write a script:
In a terminal, create the file /etc/acpi/lid.sh
, make it executable, and instruct your system to reference this file for the behavior of lid "events":
sudo touch /etc/acpi/lid.sh
sudo chmod +x /etc/acpi/lid.sh
sudo echo 'event=button/lid.*' | tee --append /etc/acpi/events/lm_lid
sudo echo 'action=/etc/acpi/lid.sh' | tee --append /etc/acpi/events/lm_lid
then, open the script for editing:
sudo nano /etc/acpi/lid.sh
The contents of this file should be: (replace your_username
with your username)
#!/bin/bash
USER=your_username
grep -q close /proc/acpi/button/lid/*/state
if [ $? = 0 ]; then
su -c "sleep 1 && xset -display :0.0 dpms force off" - $USER
fi
grep -q open /proc/acpi/button/lid/*/state
if [ $? = 0 ]; then
su -c "xset -display :0 dpms force on &> /tmp/screen.lid" - $USER
fi
CTRL + O to save and CTRL + X to exit.
Reboot your system.
This may not work with multiple users.