[SOLVED] Slackware 14.2 - how to suspend when closing the lid on the laptop?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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."
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.