LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Slackware 14.2 - how to suspend when closing the lid on the laptop? (https://www.linuxquestions.org/questions/slackware-14/slackware-14-2-how-to-suspend-when-closing-the-lid-on-the-laptop-4175585700/)

aldorgan 07-28-2016 05:40 AM

Slackware 14.2 - how to suspend when closing the lid on the laptop?
 
how to suspend when closing the lid on the laptop? As of now nothing happens at all, the computer is still on.

a4z 07-28-2016 05:43 AM

I use KDE, there it 'just works'
you might want to fine adjust KDE settings in system settings, power management
there you can define you actions what happens if you close the laptop lid.

aldorgan 07-28-2016 06:01 AM

Ok i'm using i3 window manager, so maybe i need todo something to get it to work.

imitis 07-28-2016 07:31 AM

Hi. Just create file /etc/acpi/events/lid

Code:

event=button/lid (LID)
action=/usr/sbin/pm-suspend


mralk3 07-28-2016 09:02 AM

You can also add "pm-suspend" and "pm-hibernate" to you sudoers configuration and execute suspend/hibernate from a terminal window. I do not run i3wm, but this method works well in Fluxbox.

Code:

xlock & sleep 5 ; sudo pm-suspend
or

Code:

xlock & sleep 5 ; sudo pm-hibernate

If you have an encrypted hard drive, there is no need for the "xlock & sleep5" portion since a password is required when resuming the OS from a hibernate. It still applies though if you are running "pm-suspend."

aldorgan 07-28-2016 03:33 PM

imitis: Thank you! that solved my problem, now when i close the lid it goes to suspend mode :)

ewlabonte 09-05-2016 10:45 PM

Quote:

Originally Posted by imitis (Post 5582465)
Hi. Just create file /etc/acpi/events/lid

Code:

event=button/lid (LID)
action=/usr/sbin/pm-suspend


I tried this but with pm-hibernate instead of pm-suspend. It does hibernate when I close the lid, but when it resumes, it shuts down again within a few seconds and I have to start it again. It then resumes to the state I left it, but I have to start it twice.

STDOUBT 09-05-2016 10:56 PM

ewlabonte,
I use pm-suspend. You might have a look at my solution here:
https://www.linuxquestions.org/quest...6/#post5587173

I think you might need not only a "lid close" but a "lid open" script as well.
Obviously my solution is different, but you might be able to edit things to suit your use case.
HTH

ewlabonte 09-05-2016 11:27 PM

Thank you, that was it.

event=button/lid LID close
action=/usr/sbin/pm-hibernate

works.

Thanks for your response.


All times are GMT -5. The time now is 01:29 AM.