5

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
'suspend'

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.

3
  • 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? Dec 14, 2018 at 12:20
  • The results for both commands are: 'suspend' Dec 14, 2018 at 12:30
  • 1
    Also gsettings get org.gnome.settings-daemon.plugins.power lid-close-battery-action
    – Vijay
    Dec 14, 2018 at 14:12

1 Answer 1

2

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

and

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

#HandleLidSwitch=suspend
#HandleSuspendKey=suspend
#HandleLidSwitchDocked=suspend
#HandleHibernateKey=suspend
8
  • It is already 'suspend' as you see in my comment in the OP. Dec 14, 2018 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
    – Vijay
    Dec 14, 2018 at 12:40
  • I did all what you suggest. Still programs close when I close the laptop screen. Dec 15, 2018 at 21:34
  • By "close the laptop screen" I assume you mean close the laptop lid. If not so please tell.
    – Vijay
    Dec 17, 2018 at 12:30
  • yes. This is what I mean. Dec 17, 2018 at 13:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .