Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I make GNOME 3 use pm-suspend-hybrid instead of pm-suspend when closing the lid or using suspend from the menu?

share|improve this question
    
I'm not sure if there is pm-suspend-hybrid support but you can use this to change the lid close action to hiberate gsettings get org.gnome.settings-daemon.plugins.power lid-close-ac-action "hibernate" and gsettings get org.gnome.settings-daemon.plugins.power lid-close-battery-action "hibernate" you can also use "blank" or "shutdown" as the action –  swatso33 May 3 '12 at 2:14

2 Answers 2

up vote 1 down vote accepted

Be sure it works

First of all you need to be sure pm-suspend-hybrid works on your computer. Type

sudo pm-suspend-hybrid

in console and notice if it works as expected.

Hacking

It is more the hack than a solution. But it works for me.

Execute the following commands in the console:

ls -l /usr/sbin/pm-suspend  # it should be symlink to /usr/lib/pm-utils/bin/pm-action
sudo rm /usr/sbin/pm-suspend  # just remove this link
sudo editor /usr/sbin/pm-suspend  # create new file instead of symlink

Contents of the new pm-suspend script:

#!/bin/bash
pm-suspend-hybrid
# notice that you need to execute "pm-suspend-hybrid"
# just changing symlink is not enough

Than give execution rights to this new script:

sudo chmod +x /usr/sbin/pm-suspend

Enjoy!


Notes

  • If your distribution does not use sudo command you need to be root to execute these commands.
  • It is possible that pm-suspend is located at another path on your system. Just type whereis pm-suspend to find correct path.
  • You may use any text editor of your choice instead of editor if you want or if your distribution does not have this wrapper.
share|improve this answer
1  
Thank you for this detailed answer! I had the same idea a while ago but didn't bother trying it. –  Martin Schulze Jun 11 '12 at 1:02

I have a workflow without having to create a file, without deleting the original file and that works in one command. Paste this in a terminal if you already know that your machine support hybrid suspension:

sudo mv /usr/sbin/pm-suspend /usr/sbin/pm-suspend_traditional && sudo ln -sf /usr/sbin/pm-suspend-hybrid /usr/sbin/pm-suspend

With the command above you will be enabling the hybrid suspension by default on your system. It is totally safe. Restoring The original config can restored by entering this command:

sudo mv /usr/sbin/pm-suspend_traditional /usr/sbin/pm-suspend

Step by step explanation

First you should check if your machine support H-S.

  1. check if HS is supported by pasting this in a terminal (source webupd8 http://goo.gl/kjISbj):

    sudo pm-is-supported --suspend-hybrid && echo "hybrid suspend is supported" || echo "your system doesn't support hybrid suspend"
    

    The output of this command is a message that says if your machine does support or not hybrid-suspension.

  2. Make a backup

    sudo mv /usr/sbin/pm-suspend /usr/sbin/pm-suspend_traditional

  3. Make a link instead of a script:

    sudo ln -sf /usr/sbin/pm-suspend-hybrid /usr/sbin/pm-suspend
    

That's it.

Note: The re-hack just combines steps 2 and 3.

The advantages of this method compared with Lig's one are:

  1. avoid the need to (and you shouldn't) delete the original pm-suspend file
  2. it creates a backup that allows you to restore the previous setting
  3. avoid the need of editing a new file, instead just link the original existent one with a symbolic link (ln -s).
share|improve this answer
    
Please note: Answers can be sorted in a number of ways, so "the response above" really doesn't have any context here. –  Al E. Jan 9 at 14:39
    
Yeah, I noticed, that's why I put the author's name. What would be the proper way to cite it? –  Rho con Linux Jan 10 at 11:15
    
The author name is okay. Not so useful when there's a lot of answers, though, so I would link to the answer referenced. –  Al E. Jan 10 at 12:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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