1

I am currently running GNOME on openSUSE on my laptop, there is the setting in the GNOME tweak tool to enable suspend on lid close, which works. However, I want to do the opposite, so that the computer does not suspend on lid close, but when I open the lid, the computer will wake if it has not already.

3

Disabling suspend on lid close

The disabling of suspend on lid close is well covered on this site as well as other SE sites. Here's a list of Q&A's on that particular part of your question:

Enabling wake on lid open

In setting up an action for when the lid opens, again this is covered in several questions:

The approach that I'd start with utilizes the APCI events of your hardware. With this particular approach you'd create a script that'll get triggered on the open event:

  • /etc/acpi/lid.sh

You then need to create a file with the following content:

$ cat /etc/acpi/events/lm_lid
event=button/lid.*
action=/etc/acpi/lid.sh

And then restart the ACPI service with something like this:

$ service acpid restart

/etc/acpi/lid.sh

There are many versions of scripts that you can use to perform this operation. There's one such script here.

The gist of this script is something like this:

#!/bin/bash

grep -q close /proc/acpi/button/lid/*/state
if [ $? = 0 ]; then
    echo close>>/tmp/screen.lid
fi
grep -q open /proc/acpi/button/lid/*/state
if [ $? = 0 ]; then
    echo open>>/tmp/screen.lid
fi

Within this script you'd simply need to toggle your LID or LID0 device in /proc/acpi/wakeup. Doing this toggles the LID device:

$ echo "LID" > /proc/acpi/wakeup

So in the script above, you'd check /proc/acpi/wakeup to see if it's enabled or disabled. If it's disabled, then do the above echo "LID" ..., otherwise do nothing.

References

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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