How can I make GNOME 3 use
pm-suspend-hybrid instead of
pm-suspend when closing the lid or using suspend from the menu?
Be sure it works
First of all you need to be sure
pm-suspend-hybrid works on your computer. Type
in console and notice if it works as expected.
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
#!/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
- If your distribution does not use
sudocommand you need to be root to execute these commands.
- It is possible that
pm-suspendis located at another path on your system. Just type
whereis pm-suspendto find correct path.
- You may use any text editor of your choice instead of
editorif you want or if your distribution does not have this wrapper.
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.
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.
Make a backup
sudo mv /usr/sbin/pm-suspend /usr/sbin/pm-suspend_traditional
Make a link instead of a script:
sudo ln -sf /usr/sbin/pm-suspend-hybrid /usr/sbin/pm-suspend
Note: The re-hack just combines steps 2 and 3.
The advantages of this method compared with Lig's one are:
- avoid the need to (and you shouldn't) delete the original
- it creates a backup that allows you to restore the previous setting
- avoid the need of editing a new file, instead just link the original existent one with a symbolic link (