how can I prevent my laptop from suspend or hibernate when closing its lid?

Will this work in OpenSuSE 12.1 with Gnome?
I am asking because I found it in the Ubuntu documentation site and I would like to prevent my laptop from suspend or hibernating when the lid is closed
I will appreciate all advices.

Thank you.

Stop the computer from suspending when the lid is closed

If you don’t want the computer to suspend when you close the lid, you can change the settings for that behavior. To set the computer to blank the screen, rather than suspend, when the lid is closed:
Be very careful if you change this setting. Some laptops can overheat if they are left running with the lid closed, especially if they are in a confined place like a backpack.
Open the Terminal application from the Dash.

To change the setting used when running on battery power, type this command and press Enter:

gsettings set org.gnome.settings-daemon.plugin.power lid-close-battery-action blank

To change the setting used when running on AC power, type this command and press Enter:

gsettings set org.gnome.settings-daemon.plugin.power lid-close-ac-action blank

There are other settings available besides “blank,” such as “nothing,” which causes the computer to do nothing.

Since you are using gnome (I don’t) I imagine there is a setting somewhere in or near the Power Profiles.

If there is not, try it out if you know the settings to restore. I’m guessing that it’s “hibernate” or “sleep” but I don’t necessarily know.

My advice is try it out and see. If it doesn’t work, nothing has changed. If it does work, your laptop fits your workflow better. If it completely breaks something, it didn’t fix your problem and you’re going to have to find a solution anyway. Go for it.

GNOME 3 does not provide the options in the GUI. But…I never had this behaviour anyway. You may take a look on http://extensions.gnome.org, there might be an extension that covers this issue.

Thank you.
Gnome-tweak had the option not hibernate / suspend when the laptop lid is close.
There are lot of Laptop users having problem with hibernate and suspend not working my laptop is one of them, I dont know if it is a kernel problem, or a desktop manager problem.
Thank you for your responses.

Hi,

I was looking for the same feature on my 13.1, here is the trick :

edit the file : /etc/systemd/logind.conf

line-> “HandleLidSwitch= …”
Uncomment and modify it for “HandleLidSwitch=ignore”

This way the screen will go black without turning the laptop into sleep mode.

Taken from this thread :
https://bbs.archlinux.org/viewtopic.php?id=171872

Regards.