I use Ubuntu 18.04. When I close my laptop, and open it again, I find all my previously opened programs are lost. My Power configurations has "Off" in the "Automatic Suspend". Also, in "When the Power Button is pressed" I have "Off". But closing the laptop is not pressing the power button.

The lid close action seems to already be set to "suspend":

$ gsettings get org.gnome.settings-daemon.plugins.power lid-close-ac-action

This is very annoying. I want to close my laptop (i.e., closed the screen. This is different from pressing the power button) and find all my previously opened programs.

  • what is your result of gsettings get org.gnome.settings-daemon.plugins.power lid-close-ac-action and gsettings get org.gnome.settings-daemon.plugins.power lid-close-ac-action? Are they logout or shutdown? – Alvin Liang Dec 14 '18 at 12:20
  • The results for both commands are: 'suspend' – user9371654 Dec 14 '18 at 12:30
  • 1
    Also gsettings get org.gnome.settings-daemon.plugins.power lid-close-battery-action – VeeJay Dec 14 '18 at 14:12
  • Thanks I have copy & paste error – Alvin Liang Dec 15 '18 at 4:43

Note: Suspend works on RAM, therefore you should have enough RAM to sustain all your open apps otherwise 'suspend' won't work properly. See the output of free m with all the apps usually open when you 'suspend'.

  1. Check System Settings > Power

Open terminal and run:

sudo apt install pm-utils


gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action 'suspend'
gsettings set org.gnome.settings-daemon.plugins.power lid-close-battery-action 'suspend'
  1. If that doesn't work:

    sudo gedit /etc/systemd/logind.conf

and uncomment (remove "#") from the lines

  • It is already 'suspend' as you see in my comment in the OP. – user9371654 Dec 14 '18 at 12:34
  • @user9371654 gsettings get org.gnome.settings-daemon.plugins.power lid-close-battery-action is not there in "both" the commands by @Alvin Liang – VeeJay Dec 14 '18 at 12:40
  • I did all what you suggest. Still programs close when I close the laptop screen. – user9371654 Dec 15 '18 at 21:34
  • By "close the laptop screen" I assume you mean close the laptop lid. If not so please tell. – VeeJay Dec 17 '18 at 12:30
  • yes. This is what I mean. – user9371654 Dec 17 '18 at 13:38

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.