0

How can I tell Ubuntu to turn off the screen when I close my Laptop Lid? I don't want to suspend the session, hibernate, or shut down. Simply turn off the screen. AFAIK when I close it, the screen stays on as I can see some light peeking through.

I've tried this suggestion but nothing changed.

(From that above linked site):

[To] Disable screen on lid close

Copy-paste this into the terminal (as a root):

# sudo su
echo 'event=button/lid.*' | tee --append /etc/acpi/events/lm_lid
echo 'action=/etc/acpi/lid.sh' | tee --append /etc/acpi/events/lm_lid
touch /etc/acpi/lid.sh
chmod +x /etc/acpi/lid.sh

Edit the /etc/acpi/lid.sh file, paste following content and replace the your_username with your main user name:

#!/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

If it matters, I'm running on a Dell Inspiron 15, with Ubuntu fully installed on an attached USB.

  • which ubuntu flavour are you running? – cmak.fr Jun 3 '19 at 4:39
  • @cmak.fr 19.04 disco. (Does that answer your question? I'm new to Ubuntu so am not quite sure what you mean exactly) – BruceWayne Jun 3 '19 at 4:55

Your Answer

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

Browse other questions tagged or ask your own question.