How to blank the screen when laptop lid is closed but without sleeping the computer?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















I have XUbuntu 18.04.



I want to close the lid on my laptop and have the screen immediately go blank (black) or off, but the computer itself to remain awake (active [not suspended]).



I've installed gnome-tweaks and that allowed me to disable the suspension feature, but it also disables the screen blanking.



logind.conf doesn't have a setting for this and gnome-tweaks and xfce-power both seem to override it regardless.



In regards to @ptetteh227, this file is entirely commented out. I've looked at the man page for it and there are no settings one can make to achieve the action that I need. https://pastebin.com/MXKnikKn



Have considered allowing it go to a lock screen but seems like another question to me.










share|improve this question

























  • Kindly post the content of /etc/systemd/logind.conf

    – ptetteh227
    Feb 9 at 21:45











  • I added it above to the opening question.

    – Kreezxil
    Feb 11 at 13:04


















1















I have XUbuntu 18.04.



I want to close the lid on my laptop and have the screen immediately go blank (black) or off, but the computer itself to remain awake (active [not suspended]).



I've installed gnome-tweaks and that allowed me to disable the suspension feature, but it also disables the screen blanking.



logind.conf doesn't have a setting for this and gnome-tweaks and xfce-power both seem to override it regardless.



In regards to @ptetteh227, this file is entirely commented out. I've looked at the man page for it and there are no settings one can make to achieve the action that I need. https://pastebin.com/MXKnikKn



Have considered allowing it go to a lock screen but seems like another question to me.










share|improve this question

























  • Kindly post the content of /etc/systemd/logind.conf

    – ptetteh227
    Feb 9 at 21:45











  • I added it above to the opening question.

    – Kreezxil
    Feb 11 at 13:04














1












1








1








I have XUbuntu 18.04.



I want to close the lid on my laptop and have the screen immediately go blank (black) or off, but the computer itself to remain awake (active [not suspended]).



I've installed gnome-tweaks and that allowed me to disable the suspension feature, but it also disables the screen blanking.



logind.conf doesn't have a setting for this and gnome-tweaks and xfce-power both seem to override it regardless.



In regards to @ptetteh227, this file is entirely commented out. I've looked at the man page for it and there are no settings one can make to achieve the action that I need. https://pastebin.com/MXKnikKn



Have considered allowing it go to a lock screen but seems like another question to me.










share|improve this question
















I have XUbuntu 18.04.



I want to close the lid on my laptop and have the screen immediately go blank (black) or off, but the computer itself to remain awake (active [not suspended]).



I've installed gnome-tweaks and that allowed me to disable the suspension feature, but it also disables the screen blanking.



logind.conf doesn't have a setting for this and gnome-tweaks and xfce-power both seem to override it regardless.



In regards to @ptetteh227, this file is entirely commented out. I've looked at the man page for it and there are no settings one can make to achieve the action that I need. https://pastebin.com/MXKnikKn



Have considered allowing it go to a lock screen but seems like another question to me.







xubuntu suspend power-management screen lid






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 11 at 12:08







Kreezxil

















asked Feb 9 at 19:10









KreezxilKreezxil

538




538













  • Kindly post the content of /etc/systemd/logind.conf

    – ptetteh227
    Feb 9 at 21:45











  • I added it above to the opening question.

    – Kreezxil
    Feb 11 at 13:04



















  • Kindly post the content of /etc/systemd/logind.conf

    – ptetteh227
    Feb 9 at 21:45











  • I added it above to the opening question.

    – Kreezxil
    Feb 11 at 13:04

















Kindly post the content of /etc/systemd/logind.conf

– ptetteh227
Feb 9 at 21:45





Kindly post the content of /etc/systemd/logind.conf

– ptetteh227
Feb 9 at 21:45













I added it above to the opening question.

– Kreezxil
Feb 11 at 13:04





I added it above to the opening question.

– Kreezxil
Feb 11 at 13:04










2 Answers
2






active

oldest

votes


















2














open a terminal and type:



xset dpms force off


as soon as you mouse moves or you press a button, the monitor will come alive again.
If you would like to run that code whenever you close the lid, you'll have to some more work:
Add to following line into /etc/acpi/events/lid:



event=button/lid
action=/etc/acpi/actions/handleLidClose.sh %e


Now create the file: /etc/acpi/actions/handleLidClose.sh
and paste the code



#!/bin/bash
echo "$1" | grep -q open /proc/acpi/button/lid/LID0/state && exit 0
xset dpms force off


into it.



You can name the file any way you want, but dont forget to make it executable:



chmod +x /etc/acpi/actions/handleLidClose.sh


All commands must be excecuted as sudo or su






share|improve this answer
























  • I did everything as you suggested. the xset dpms force off work flawless from a term window. The rest of it did not and even run tests to see if the states were correct and they were. However when using the acpi script according to your instructions, closing the lid would not turn off the screen. It feels like acpid was deferring to possibly gnome-tweaks or something else.

    – Kreezxil
    Feb 11 at 13:03











  • @Kreezxil, IMO, the approach suggested by kanehekili is correct, but you need to catch the right acpi event on your laptop. Here are three answers of mine that solve similar tasks and contain step-by-step instructions: (1) How do I disable the touchpad when the lid is twisted or closed? (2) A new use for Lenovo onekey recovery key. (3) Ubuntu 17.10 laptop doesn't suspend on lid close.

    – pa4080
    Feb 12 at 18:27



















1














To prevent the machine from suspending when lid is closed.
sudo nano /etc/systemd/logind.conf



and uncomment the parameter below



...
HandleLidSwitch=ignore
...


now restart systemd daemon:



sudo service systemd-logind restart


this works on the fly without need to do a reboot
to revert back to the default suspending when lid close,d just comment that line like before






share|improve this answer
























  • Hello, ptetteh227, do we need to do something additional to power off the lid with this approach?

    – pa4080
    Feb 12 at 18:31






  • 1





    I didn't have to do anything additional as my laptops screen goes off automatically when i close the lid. haven't tried on another laptop though

    – ptetteh227
    Feb 12 at 20:02











  • @ptetteh227 my screen doesn't automatically turn off when i close the lid. Which desktop are you using? maybe that holds part of the solution.

    – Kreezxil
    Feb 14 at 12:43











  • I use lubuntu 18.04.

    – ptetteh227
    Feb 17 at 15:31












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1116981%2fhow-to-blank-the-screen-when-laptop-lid-is-closed-but-without-sleeping-the-compu%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














open a terminal and type:



xset dpms force off


as soon as you mouse moves or you press a button, the monitor will come alive again.
If you would like to run that code whenever you close the lid, you'll have to some more work:
Add to following line into /etc/acpi/events/lid:



event=button/lid
action=/etc/acpi/actions/handleLidClose.sh %e


Now create the file: /etc/acpi/actions/handleLidClose.sh
and paste the code



#!/bin/bash
echo "$1" | grep -q open /proc/acpi/button/lid/LID0/state && exit 0
xset dpms force off


into it.



You can name the file any way you want, but dont forget to make it executable:



chmod +x /etc/acpi/actions/handleLidClose.sh


All commands must be excecuted as sudo or su






share|improve this answer
























  • I did everything as you suggested. the xset dpms force off work flawless from a term window. The rest of it did not and even run tests to see if the states were correct and they were. However when using the acpi script according to your instructions, closing the lid would not turn off the screen. It feels like acpid was deferring to possibly gnome-tweaks or something else.

    – Kreezxil
    Feb 11 at 13:03











  • @Kreezxil, IMO, the approach suggested by kanehekili is correct, but you need to catch the right acpi event on your laptop. Here are three answers of mine that solve similar tasks and contain step-by-step instructions: (1) How do I disable the touchpad when the lid is twisted or closed? (2) A new use for Lenovo onekey recovery key. (3) Ubuntu 17.10 laptop doesn't suspend on lid close.

    – pa4080
    Feb 12 at 18:27
















2














open a terminal and type:



xset dpms force off


as soon as you mouse moves or you press a button, the monitor will come alive again.
If you would like to run that code whenever you close the lid, you'll have to some more work:
Add to following line into /etc/acpi/events/lid:



event=button/lid
action=/etc/acpi/actions/handleLidClose.sh %e


Now create the file: /etc/acpi/actions/handleLidClose.sh
and paste the code



#!/bin/bash
echo "$1" | grep -q open /proc/acpi/button/lid/LID0/state && exit 0
xset dpms force off


into it.



You can name the file any way you want, but dont forget to make it executable:



chmod +x /etc/acpi/actions/handleLidClose.sh


All commands must be excecuted as sudo or su






share|improve this answer
























  • I did everything as you suggested. the xset dpms force off work flawless from a term window. The rest of it did not and even run tests to see if the states were correct and they were. However when using the acpi script according to your instructions, closing the lid would not turn off the screen. It feels like acpid was deferring to possibly gnome-tweaks or something else.

    – Kreezxil
    Feb 11 at 13:03











  • @Kreezxil, IMO, the approach suggested by kanehekili is correct, but you need to catch the right acpi event on your laptop. Here are three answers of mine that solve similar tasks and contain step-by-step instructions: (1) How do I disable the touchpad when the lid is twisted or closed? (2) A new use for Lenovo onekey recovery key. (3) Ubuntu 17.10 laptop doesn't suspend on lid close.

    – pa4080
    Feb 12 at 18:27














2












2








2







open a terminal and type:



xset dpms force off


as soon as you mouse moves or you press a button, the monitor will come alive again.
If you would like to run that code whenever you close the lid, you'll have to some more work:
Add to following line into /etc/acpi/events/lid:



event=button/lid
action=/etc/acpi/actions/handleLidClose.sh %e


Now create the file: /etc/acpi/actions/handleLidClose.sh
and paste the code



#!/bin/bash
echo "$1" | grep -q open /proc/acpi/button/lid/LID0/state && exit 0
xset dpms force off


into it.



You can name the file any way you want, but dont forget to make it executable:



chmod +x /etc/acpi/actions/handleLidClose.sh


All commands must be excecuted as sudo or su






share|improve this answer













open a terminal and type:



xset dpms force off


as soon as you mouse moves or you press a button, the monitor will come alive again.
If you would like to run that code whenever you close the lid, you'll have to some more work:
Add to following line into /etc/acpi/events/lid:



event=button/lid
action=/etc/acpi/actions/handleLidClose.sh %e


Now create the file: /etc/acpi/actions/handleLidClose.sh
and paste the code



#!/bin/bash
echo "$1" | grep -q open /proc/acpi/button/lid/LID0/state && exit 0
xset dpms force off


into it.



You can name the file any way you want, but dont forget to make it executable:



chmod +x /etc/acpi/actions/handleLidClose.sh


All commands must be excecuted as sudo or su







share|improve this answer












share|improve this answer



share|improve this answer










answered Feb 9 at 22:36









kanehekilikanehekili

6613




6613













  • I did everything as you suggested. the xset dpms force off work flawless from a term window. The rest of it did not and even run tests to see if the states were correct and they were. However when using the acpi script according to your instructions, closing the lid would not turn off the screen. It feels like acpid was deferring to possibly gnome-tweaks or something else.

    – Kreezxil
    Feb 11 at 13:03











  • @Kreezxil, IMO, the approach suggested by kanehekili is correct, but you need to catch the right acpi event on your laptop. Here are three answers of mine that solve similar tasks and contain step-by-step instructions: (1) How do I disable the touchpad when the lid is twisted or closed? (2) A new use for Lenovo onekey recovery key. (3) Ubuntu 17.10 laptop doesn't suspend on lid close.

    – pa4080
    Feb 12 at 18:27



















  • I did everything as you suggested. the xset dpms force off work flawless from a term window. The rest of it did not and even run tests to see if the states were correct and they were. However when using the acpi script according to your instructions, closing the lid would not turn off the screen. It feels like acpid was deferring to possibly gnome-tweaks or something else.

    – Kreezxil
    Feb 11 at 13:03











  • @Kreezxil, IMO, the approach suggested by kanehekili is correct, but you need to catch the right acpi event on your laptop. Here are three answers of mine that solve similar tasks and contain step-by-step instructions: (1) How do I disable the touchpad when the lid is twisted or closed? (2) A new use for Lenovo onekey recovery key. (3) Ubuntu 17.10 laptop doesn't suspend on lid close.

    – pa4080
    Feb 12 at 18:27

















I did everything as you suggested. the xset dpms force off work flawless from a term window. The rest of it did not and even run tests to see if the states were correct and they were. However when using the acpi script according to your instructions, closing the lid would not turn off the screen. It feels like acpid was deferring to possibly gnome-tweaks or something else.

– Kreezxil
Feb 11 at 13:03





I did everything as you suggested. the xset dpms force off work flawless from a term window. The rest of it did not and even run tests to see if the states were correct and they were. However when using the acpi script according to your instructions, closing the lid would not turn off the screen. It feels like acpid was deferring to possibly gnome-tweaks or something else.

– Kreezxil
Feb 11 at 13:03













@Kreezxil, IMO, the approach suggested by kanehekili is correct, but you need to catch the right acpi event on your laptop. Here are three answers of mine that solve similar tasks and contain step-by-step instructions: (1) How do I disable the touchpad when the lid is twisted or closed? (2) A new use for Lenovo onekey recovery key. (3) Ubuntu 17.10 laptop doesn't suspend on lid close.

– pa4080
Feb 12 at 18:27





@Kreezxil, IMO, the approach suggested by kanehekili is correct, but you need to catch the right acpi event on your laptop. Here are three answers of mine that solve similar tasks and contain step-by-step instructions: (1) How do I disable the touchpad when the lid is twisted or closed? (2) A new use for Lenovo onekey recovery key. (3) Ubuntu 17.10 laptop doesn't suspend on lid close.

– pa4080
Feb 12 at 18:27













1














To prevent the machine from suspending when lid is closed.
sudo nano /etc/systemd/logind.conf



and uncomment the parameter below



...
HandleLidSwitch=ignore
...


now restart systemd daemon:



sudo service systemd-logind restart


this works on the fly without need to do a reboot
to revert back to the default suspending when lid close,d just comment that line like before






share|improve this answer
























  • Hello, ptetteh227, do we need to do something additional to power off the lid with this approach?

    – pa4080
    Feb 12 at 18:31






  • 1





    I didn't have to do anything additional as my laptops screen goes off automatically when i close the lid. haven't tried on another laptop though

    – ptetteh227
    Feb 12 at 20:02











  • @ptetteh227 my screen doesn't automatically turn off when i close the lid. Which desktop are you using? maybe that holds part of the solution.

    – Kreezxil
    Feb 14 at 12:43











  • I use lubuntu 18.04.

    – ptetteh227
    Feb 17 at 15:31
















1














To prevent the machine from suspending when lid is closed.
sudo nano /etc/systemd/logind.conf



and uncomment the parameter below



...
HandleLidSwitch=ignore
...


now restart systemd daemon:



sudo service systemd-logind restart


this works on the fly without need to do a reboot
to revert back to the default suspending when lid close,d just comment that line like before






share|improve this answer
























  • Hello, ptetteh227, do we need to do something additional to power off the lid with this approach?

    – pa4080
    Feb 12 at 18:31






  • 1





    I didn't have to do anything additional as my laptops screen goes off automatically when i close the lid. haven't tried on another laptop though

    – ptetteh227
    Feb 12 at 20:02











  • @ptetteh227 my screen doesn't automatically turn off when i close the lid. Which desktop are you using? maybe that holds part of the solution.

    – Kreezxil
    Feb 14 at 12:43











  • I use lubuntu 18.04.

    – ptetteh227
    Feb 17 at 15:31














1












1








1







To prevent the machine from suspending when lid is closed.
sudo nano /etc/systemd/logind.conf



and uncomment the parameter below



...
HandleLidSwitch=ignore
...


now restart systemd daemon:



sudo service systemd-logind restart


this works on the fly without need to do a reboot
to revert back to the default suspending when lid close,d just comment that line like before






share|improve this answer













To prevent the machine from suspending when lid is closed.
sudo nano /etc/systemd/logind.conf



and uncomment the parameter below



...
HandleLidSwitch=ignore
...


now restart systemd daemon:



sudo service systemd-logind restart


this works on the fly without need to do a reboot
to revert back to the default suspending when lid close,d just comment that line like before







share|improve this answer












share|improve this answer



share|improve this answer










answered Feb 12 at 17:16









ptetteh227ptetteh227

1,033319




1,033319













  • Hello, ptetteh227, do we need to do something additional to power off the lid with this approach?

    – pa4080
    Feb 12 at 18:31






  • 1





    I didn't have to do anything additional as my laptops screen goes off automatically when i close the lid. haven't tried on another laptop though

    – ptetteh227
    Feb 12 at 20:02











  • @ptetteh227 my screen doesn't automatically turn off when i close the lid. Which desktop are you using? maybe that holds part of the solution.

    – Kreezxil
    Feb 14 at 12:43











  • I use lubuntu 18.04.

    – ptetteh227
    Feb 17 at 15:31



















  • Hello, ptetteh227, do we need to do something additional to power off the lid with this approach?

    – pa4080
    Feb 12 at 18:31






  • 1





    I didn't have to do anything additional as my laptops screen goes off automatically when i close the lid. haven't tried on another laptop though

    – ptetteh227
    Feb 12 at 20:02











  • @ptetteh227 my screen doesn't automatically turn off when i close the lid. Which desktop are you using? maybe that holds part of the solution.

    – Kreezxil
    Feb 14 at 12:43











  • I use lubuntu 18.04.

    – ptetteh227
    Feb 17 at 15:31

















Hello, ptetteh227, do we need to do something additional to power off the lid with this approach?

– pa4080
Feb 12 at 18:31





Hello, ptetteh227, do we need to do something additional to power off the lid with this approach?

– pa4080
Feb 12 at 18:31




1




1





I didn't have to do anything additional as my laptops screen goes off automatically when i close the lid. haven't tried on another laptop though

– ptetteh227
Feb 12 at 20:02





I didn't have to do anything additional as my laptops screen goes off automatically when i close the lid. haven't tried on another laptop though

– ptetteh227
Feb 12 at 20:02













@ptetteh227 my screen doesn't automatically turn off when i close the lid. Which desktop are you using? maybe that holds part of the solution.

– Kreezxil
Feb 14 at 12:43





@ptetteh227 my screen doesn't automatically turn off when i close the lid. Which desktop are you using? maybe that holds part of the solution.

– Kreezxil
Feb 14 at 12:43













I use lubuntu 18.04.

– ptetteh227
Feb 17 at 15:31





I use lubuntu 18.04.

– ptetteh227
Feb 17 at 15:31


















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1116981%2fhow-to-blank-the-screen-when-laptop-lid-is-closed-but-without-sleeping-the-compu%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Human spaceflight

Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

File:DeusFollowingSea.jpg