Glam Prestige Journal

Bright entertainment trends with youth appeal.

I just upgraded to Ubuntu 18.04.2 LTS and figured out that there is no option in settings to change the lid closing behavior.

I tried the command line method from the answer here:

HandleLidSwitch=ignore 

worked successfully. But, this thing doesn't turn off the screen like it happens in Windows.

I want to keep the System running, but turn the screen off when the lid is closed.

1

1 Answer

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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy