Ubuntu – Resume from Suspend closes applications

laptoppower-managementsuspend

Just loaded Ubuntu 15.10 on my old HP E1 Vision and am very pleased with it. I have a minor issue in that if I Suspend using the power icon in the upper right corner of the screen, close the lid and then open later, the automatic resume loses all of the applications I had open.

This does not happen if I leave the lid open and resume with the power button on the console. Also does not happen if I Suspend by closing the lid. As I say this is minor and the work around is to avoid suspending with the power icon. Thoughts?

Best Answer

Create the file /etc/acpi/local/lid.sh.post and add the following to it:

#!/bin/bash
grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then
/usr/sbin/pm-suspend
fi

Make the file executable with chmod +x lid.sh.post and your problem should be solved.

Related Question